- Is it possible to get
IntA.__new__
to return an object of typeIntA
without calling__new__
on the parent class? - Is this situation unique to integer or builtin types?
>>> class IntA(int):
... def __new__(cls, i=0):
... return i
...
>>> class IntB(int):
... def __new__(cls, i=0):
... return int.__new__(cls, i)
...
>>> type(IntA())
<class 'int'>
>>> type(IntB())
<class '__main__.IntB'>
>>>