inst.name = name
return inst

def __str__(self):
    return self.name
x = NamedInteger(5)
print(x + 3)
print(str(x))
x = NamedInteger(3, 'foo')
print(x + 3)
print(str(x))
How to add a constructor to a subclassed numeric type?