Nick Coghlan <[EMAIL PROTECTED]> added the comment: The problem actually has to do with trying to use update_wrapper on a method instead of a function - bound and unbound methods don't have all the same attributes that actual functions do.
>>> import functools >>> functools.WRAPPER_ASSIGNMENTS ('__module__', '__name__', '__doc__') >>> functools.WRAPPER_UPDATES ('__dict__',) >>> def f(): pass ... >>> class C: ... def m(): pass ... >>> set(dir(f)) - set(dir(C.m)) set(['func_closure', 'func_dict', '__module__', 'func_name', 'func_defaults', '__dict__', '__name__', 'func_code', 'func_doc', 'func_globals']) Is an exception the right response when encountering a missing attribute? Given that the error can be explicitly silenced by writing "functools.update_wrapper(g, str.split, set(functools.WRAPPER_ASSIGNMENTS) & set(dir(str.split)))", I'm inclined to think the current behaviour is the correct option. Since this is an issue that doesn't come up with the main intended use case for update_wrapper (writing decorators), and since it can be handled easily by limiting the set of attributes copied to those the object actually has, I'm converting this tracker item to an enhancement request asking for a shorter way of spelling "ignore missing attributes" (e.g. a keyword-only flag). ---------- assignee: ncoghlan -> priority: -> normal type: behavior -> feature request versions: +Python 2.7, Python 3.1 -Python 2.5 _______________________________________ 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