2014-05-21 21:32:00 +00:00
|
|
|
class A:
|
|
|
|
def __new__(cls):
|
|
|
|
print("A.__new__")
|
|
|
|
return super(cls, A).__new__(cls)
|
|
|
|
|
|
|
|
def __init__(self):
|
|
|
|
pass
|
|
|
|
|
|
|
|
def meth(self):
|
2014-07-05 04:55:00 +00:00
|
|
|
print('A.meth')
|
2014-05-21 21:32:00 +00:00
|
|
|
|
|
|
|
#print(A.__new__)
|
|
|
|
#print(A.__init__)
|
|
|
|
|
|
|
|
a = A()
|
2014-07-05 04:55:00 +00:00
|
|
|
a.meth()
|
|
|
|
|
|
|
|
a = A.__new__(A)
|
|
|
|
a.meth()
|
2014-05-21 21:32:00 +00:00
|
|
|
|
|
|
|
#print(a.meth)
|
|
|
|
#print(a.__init__)
|
|
|
|
#print(a.__new__)
|
2014-07-05 04:55:00 +00:00
|
|
|
|
|
|
|
# __new__ should automatically be a staticmethod, so this should work
|
|
|
|
a = a.__new__(A)
|
|
|
|
a.meth()
|
2015-08-21 10:56:14 +00:00
|
|
|
|
|
|
|
class B:
|
|
|
|
def __new__(self, v1, v2):
|
|
|
|
None
|
|
|
|
B(1, 2)
|