I try to inherit from int and write the increase() function for it.
import math
class Counter(int):
def increase(self):
self += 1
# it should be less then 2**32
maximum = math.pow(2, 32)
if self > maximum:
self -= maximum
counter = Counter(10)
print counter
counter.increase()
print counter
counter.increase()
print counter
ouput:
10
10
10
It doesn't work! Why and how to write the code?
