Dennis Sweeney <[email protected]> added the comment:
This is because int, str, and complex are immutable. If I have
class MyInt(int):
def __init__(self, stuff):
pass
then when I call MyInt("19"), the string "19" is passed to the constructor
int.__new__ before the overridden initializer MyInt.__init__. You can only
override that by implementing a MyInt.__new__ to override the int constructor.
This is not a bug.
----------
nosy: +Dennis Sweeney
_______________________________________
Python tracker <[email protected]>
<https://bugs.python.org/issue42334>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com