class MyNumber(object):

    def __init__(self, x):
        self.x = x
print(10 - MyNumber(9))


class MyFixedNumber(MyNumber):

    def __rsub__(self, other):
        return MyNumber(other - self.x)
print(10 - MyFixedNumber(9))
Using reverse operators in Python