how to get name of function from within function?

has has.temp2 at virgin.net
Fri Jun 3 19:13:09 EDT 2005


Christopher J. Bottaro wrote:

> Basically I want to wrap every function in try/except automatically.

Simplest way to do that would be something like:

def wrapFunction(func):
    def wrapper(*args, **kargs):
        try:
            return func(*args, **kargs)
        except Exception, e:
            raise # your error handling code here
    return wrapper

HTH




More information about the Python-list mailing list