I\'ve got a pretty good understanding of python\'s try-except clause, but I\'m encountering problems when trying to put it inside of a function.
>>>
The name error is happening before it ever gets into tryAppend. It evaluates the value of foo when trying to pass it to the function. This works:
def tryAppend(child, parent): parent.append(child) var1 = [] try: tryAppend(foo, var1) except NameError: print 'WRONG NAME'