class MyFancyNumber(object):

    def __init__(self, num, info):
        self.num = num
self.info = info

def __repr__(self):
    return 'MyFancyNumber({}, {})'.format(repr(self.num), repr(self.info))

def make_func(name):
    return lambda self, *args: MyFancyNumber(getattr(self.num, name)(*args),
        self.info)
for name in ['__add__', '__sub__', '__mul__', '__div__', '__invert__',
    '__neg__', '__pos__']:
    setattr(MyFancyNumber, name, make_func(name))
x = MyFancyNumber(50, 'hello')
print(x + 10)
print(x - 10)
print(x * 10)
print(x / 10)
print(~x)
print(-x)
print(+x)
Overload all arithmetic operators in Python