Hi everyone,

is there a sufficiently easy possibility for a Python function to find
out whether it has been called from a try-block or not?

try:
  print "Calling foo"
  foo()
except:
  print "Got exception"

In the example above, foo() should be able to 'see' that it was called
from a try block, allowing it to behave differently.

Can this information be obtained from the traceback/frame/code
objects, or is that too difficult?

Many thanks for your help,
Elmar
--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to