im trying to modify the behaviour of the 'int' type in Python.
it says
'__new__' is readonly.
Is there a way to do it?
thanks.
im trying to modify the behaviour of the 'int' type in Python.
it says
'__new__' is readonly.
Is there a way to do it?
thanks.
You can't modify a built-in type, but you can derive from it:
class MyInt(int):
def __new__(cls, *args):
# whatever