Is it possible to define a data object in python that behaves like a normal integer when used in mathematical operations or comparisons, but is also able to store instance variables?
In other words, it should be possible to do the following things:
pseudo_integer = PseudoInteger(5, hidden_object="Hello World!")
print(5 + pseudo_integer) # Prints "10"
print(pseudo_integer == 5) # Prints "True"
print(pseudo_integer.hidden_object) # Prints "Hello World!"
hidden_objectto be, after a addition ?hidden_objectafter an addition, so it's okay if it's gone. I just need it to either be able to be added, compared orhidden_objectto be obtained.5 + pseudo_integerto have? Should it have typeint, or typePseudoInteger? What aboutpseudo_integer + pseudo_integer?