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
>>> magic = lambda x: eval('2 * (x + 2) ** 2 - 8') >>> magic(2) 24 >>> magic(3) 42 >>> magic = lambda x: eval('x ** 4') >>> magic(2) 16 >>> magic(3) 81