2014-05-21 17:32:00 -04: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 00:55:00 -04:00
|
|
|
print('A.meth')
|
2014-05-21 17:32:00 -04:00
|
|
|
|
|
|
|
#print(A.__new__)
|
|
|
|
#print(A.__init__)
|
|
|
|
|
|
|
|
a = A()
|
2014-07-05 00:55:00 -04:00
|
|
|
a.meth()
|
|
|
|
|
|
|
|
a = A.__new__(A)
|
|
|
|
a.meth()
|
2014-05-21 17:32:00 -04:00
|
|
|
|
|
|
|
#print(a.meth)
|
|
|
|
#print(a.__init__)
|
|
|
|
#print(a.__new__)
|
2014-07-05 00:55:00 -04:00
|
|
|
|
|
|
|
# __new__ should automatically be a staticmethod, so this should work
|
|
|
|
a = a.__new__(A)
|
|
|
|
a.meth()
|
2015-08-21 06:56:14 -04:00
|
|
|
|
|
|
|
class B:
|
|
|
|
def __new__(self, v1, v2):
|
|
|
|
None
|
|
|
|
B(1, 2)
|