This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author findepi
Recipients Antoine d'Otreppe, benjamin.peterson, findepi, ncoghlan, pitrou
Date 2008-08-21.20:33:39
SpamBayes Score 3.8202077e-07
Marked as misclassified No
Message-id <1219350821.16.0.848573229931.issue3445@psf.upfronthosting.co.za>
In-reply-to
Content
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.
History
Date User Action Args
2008-08-21 20:33:41findepisetrecipients: + findepi, ncoghlan, pitrou, benjamin.peterson, Antoine d'Otreppe
2008-08-21 20:33:41findepisetmessageid: <1219350821.16.0.848573229931.issue3445@psf.upfronthosting.co.za>
2008-08-21 20:33:40findepilinkissue3445 messages
2008-08-21 20:33:39findepicreate