Open masterPiece93 opened 6 months ago
Subclassing int in Python
int is immutable so you can't modify it after it is created, use new instead
class TestClass(int): def __new__(cls, *args, **kwargs): return super(TestClass, cls).__new__(cls, 5) print TestClass()
Subclassing int in Python
int is immutable so you can't modify it after it is created, use new instead