1

I am trying to make a function find out the original expression which was used as an argument to a function. Example:

def fun(var):
    exp_var = <some magic>
    print "%s = %s"%(exp_var, var)

so that:

>>> fun(4.5+2*2)

will print

4.5+2*2 = 8.5

I think there should be a way using python's inspect module but I couldn't find how.

jonrsharpe
  • 115,751
  • 26
  • 228
  • 437
tal
  • 860
  • 7
  • 19

0 Answers0