how to get name of function from within function?
steven.bethard at gmail.com
Sat Jun 4 23:30:48 CEST 2005
Christopher J. Bottaro wrote:
> Kent Johnson wrote:
>> def func_a(self):
>> print "func_a"
>> def func_b(self):
>> print "func_b"
>> raise Exception
>>You could probably create a metaclass to apply the wrappers automatically
>>but I like having it explicit as above.
> Another good solution, thank you. Maybe a reason to upgrade to 2.4...=)
If you can't upgrade, you can write Kent's code like:
func_a = in_try(func_a)
func_b = in_try(func_b)
More information about the Python-list