I want to write  function that prints a value of a variable, for
debugging. Like:

with

myVariable = "parrot"
otherVariable = "dead"

probe(myVariable)
probe(otherVariable)

instead of the longer

print "myVariable = ", myVariable
print "otherVariable = ", otherVariable

Is that even possible?

The function would look like

def probe(var):
    nameOfVar = someMagic(var)
    print nameOfVar, " = ", var

but can someMagic(var) find the variable name? Is that possible?
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to