Subclassing Int And Overriding The __init__ Method - Python
Possible Duplicate: inheritance from str or int Hi folks, I'm trying to subclass the int class without any success. Here is my attempt: class SpecialInt(int): def __init__(s
Solution 1:
See __new__
:
__new__
() is intended mainly to allow subclasses of immutable types (like int, str, or tuple) to customize instance creation. It is also commonly overridden in custom metaclasses in order to customize class creation.
Post a Comment for "Subclassing Int And Overriding The __init__ Method - Python"