I\'m wondering if there exists a python module that would allow me to do something like this:
x = MagicNumber() x.value = 3 y = 2 * (x + 2) ** 2 - 8 print y
I think the difficulty is in "how to keep operators priority" rather than implementing a class.
I suggest to look at a different notation (like Reverse Polish Notation) that may help in getting rid of priority issues...