circuitpython/tests/basics/class_new.py
Paul Sokolovsky 806ea1f6ca py: Initial attempts to actually allow implementing __new__ in Python.
Caveat is that __new__ should recurse to base class __new__, and ultimately,
object.__new__ is what handles instance allocation.
2014-05-22 00:32:00 +03:00

22 lines
291 B
Python

class A:
@staticmethod
def __new__(cls):
print("A.__new__")
return super(cls, A).__new__(cls)
def __init__(self):
pass
def meth(self):
pass
#print(A.__new__)
#print(A.__init__)
a = A()
#print(a.meth)
#print(a.__init__)
#print(a.__new__)