First page Back Continue Last page Overview Graphics

__radd__

We want to add Length objects to integers:

Z = 1 + Length(4.5, "yd")

def __radd__(self, other):

z = self + other

z.unit = "m"

z.value *= Length.__metric[self.unit]

return z

5 + Length(3, "yd")

__radd__(self,other)

Length(3, "yd") + 5

__add__(self,other)