R. David Murray added the comment:
To set the value of an immutable type you must use the __new__ method. By the
time __init__ is called the value has already be established, and in the case
of int it defaults to 0.
--
nosy: +r.david.murray
resolution: -> invalid
stage: -> committe
New submission from João Bernardo :
I'm having trouble subclassing the int type and I think this behavior is a
bug... (Python 3.2)
>>> class One(int):
def __init__(self):
super().__init__(1)
>>> one = One()
>>> one + 2
2
>>> one == 0
True
I know `int` objects are immut