Re: The problem of anonymity with decorators

2006-02-08 Thread Franck Pommereau
Alex, Michele and Skip, Many thanks for your help, I should find my way by putting all these information together. Best regards, Franck -- http://mail.python.org/mailman/listinfo/python-list

Re: The problem of anonymity with decorators

2006-02-07 Thread skip
Franck> My problem is that the errors comes from a function named Franck> "wrapped" while I'd prefer to see here the name of the wrapped Franck> function. Take a look at http://wiki.python.org/moin/PythonDecoratorLibrary In particular, check out the Decorator decorator. Skip --

Re: The problem of anonymity with decorators

2006-02-07 Thread Michele Simionato
Using my decorator module (http://www.phyast.pitt.edu/~micheles/python/documentation.html, http://www.phyast.pitt.edu/~micheles/python/decorator.zip) you solve the problem of the name, but the traceback is still not perfect. You get: # dec_traceback.py from ms.decorator import decorator @decorato

Re: The problem of anonymity with decorators

2006-02-07 Thread Alex Martelli
Franck Pommereau <[EMAIL PROTECTED]> wrote: ... > import new > def rename (fun, name) : > return new.function(fun.func_code, {}, name) You need to make a new code object too: def int_result(fun) : def wrapped(*largs, **kwargs) : result = fun(*largs, **kwargs)

The problem of anonymity with decorators

2006-02-07 Thread Franck Pommereau
Dear all, I would like to work around the "anonymizing" effect of decorators when an exception is raised in the wrapped function. Let's consider the following example: def int_result (fun) : def wrapped (*largs, **kwargs) : result = fun(*largs, **kwargs) if not