class Foo(object):
def __init__(self, value):
self.value = value
def incr(self):
self.value += 1
def __add__(self, other):
return int.__add__(self.value, other)
def __sub__(self, other):
return int.__sub__(self.value, other)
def __mul__(self, other):
return int.__mul__(self.value, other)
def __floordiv__(self, other):
return int.__floordiv__(self.value, other)
def __mod__(self, other):
return int.__mod__(self.value, other)
def __divmod__(self, other):
return int.__divmod__(self.value, other)
def __pow__(self, other):
return int.__pow__(self.value, other)
def __lshift__(self, other):
return int.__lshift__(self.value, other)
def __rshift__(self, other):
return int.__rshift__(self.value, other)
def __and__(self, other):
return int.__and__(self.value, other)
def __xor__(self, other):
return int.__xor__(self.value, other)
def __or__(self, other):
return int.__or__(self.value, other)
def __radd__(self, other):
return int.__radd__(self.value, other)
def __rsub__(self, other):
return int.__rsub__(self.value, other)
def __rmul__(self, other):
return int.__rmul__(self.value, other)
def __rdiv__(self, other):
return int.__rdiv__(self.value, other)
def __rtruediv__(self, other):
return int.__rtruediv__(self.value, other)
def __rfloordiv__(self, other):
return int.__rfloordiv__(self.value, other)
def __rmod__(self, other):
return int.__rmod__(self.value, other)
def __rdivmod__(self, other):
return int.__rdivmod__(self.value, other)
def __rpow__(self, other):
return int.__rpow__(self.value, other)
def __rlshift__(self, other):
return int.__rlshift__(self.value, other)
def __rrshift__(self, other):
return int.__rrshift__(self.value, other)
def __rand__(self, other):
return int.__rand__(self.value, other)
def __rxor__(self, other):
return int.__rxor__(self.value, other)
def __ror__(self, other):
return int.__ror__(self.value, other)
def __iadd__(self, other):
return int.__iadd__(self.value, other)
def __isub__(self, other):
return int.__isub__(self.value, other)
def __imul__(self, other):
return int.__imul__(self.value, other)
def __idiv__(self, other):
return int.__idiv__(self.value, other)
def __itruediv__(self, other):
return int.__itruediv__(self.value, other)
def __ifloordiv__(self, other):
return int.__ifloordiv__(self.value, other)
def __imod__(self, other):
return int.__imod__(self.value, other)
def __ipow__(self, other):
return int.__ipow__(self.value, other)
def __ilshift__(self, other):
return int.__ilshift__(self.value, other)
def __irshift__(self, other):
return int.__irshift__(self.value, other)
def __iand__(self, other):
return int.__iand__(self.value, other)
def __ixor__(self, other):
return int.__ixor__(self.value, other)
def __ior__(self, other):
return int.__ior__(self.value, other)
def __neg__(self):
return int.__neg__(self.value)
def __pos__(self):
return int.__pos__(self.value)
def __abs__(self):
return int.__abs__(self.value)
def __invert__(self):
return int.__invert__(self.value)
def __complex__(self):
return int.__complex__(self.value)
def __int__(self):
return int.__int__(self.value)
def __long__(self):
return int.__long__(self.value)
def __float__(self):
return int.__float__(self.value)
def __oct__(self):
return int.__oct__(self.value)
def __hex__(self):
return int.__hex__(self.value)
def __index__(self):
return int.__index__(self.value)
f = Foo(3)
print(f)
print(f.value)
print(f.incr())
print(f.value)
print(f + 2)