Piotr Findeisen <[EMAIL PROTECTED]> added the comment:

IMO, I'd be better to always ignore missing attributes. Consider another
use case (following code I've posted also on comp.lang.python):

from functools import wraps, partial
def never_throw(f):
    @wraps(f)
    def wrapper(*args, **kwargs):
        try: return f(*args, **kwargs)
        except: pass
    return wrapper 

Looks reasonable. But if I write
never_throw(partial(int))('45a')
I got the exception saying partial objects also don't have __module__
attribute.

I was to use some additional parameters to @wraps, I would have to
rewrite all my decorator definitions. And stil -- the main intent of
wraps and update_wrapper is to write decorators, so IMO they should not
throw on missing attributes.

----------
nosy: +findepi

_______________________________________
Python tracker <[EMAIL PROTECTED]>
<http://bugs.python.org/issue3445>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to