[issue5982] classmethod, staticmethod: expose wrapped function
Raymond Hettinger rhettin...@users.sourceforge.net added the comment: r73005 and r73006 -- status: open - closed ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue5982 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue5982] classmethod, staticmethod: expose wrapped function
Amaury Forgeot d'Arc amaur...@gmail.com added the comment: Is there a difficulty I did not see? Here is a patch. -- keywords: +patch nosy: +amaury.forgeotdarc Added file: http://bugs.python.org/file14021/staticmethod_func.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue5982 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue5982] classmethod, staticmethod: expose wrapped function
Changes by Raymond Hettinger rhettin...@users.sourceforge.net: -- assignee: - amaury.forgeotdarc resolution: - accepted ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue5982 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue5982] classmethod, staticmethod: expose wrapped function
George Sakkis george.sak...@gmail.com added the comment: I don't remember the exact use case but it had to do with making a decorator robust enough to work for different kinds of callables (and a few common non-callables such as classmethod/staticmethod). It's not a show stopper by any means but I thought it would be easy (if not trivial) to implement, and regardless of actual use cases I don't see a reason to keep the function hidden. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue5982 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue5982] classmethod, staticmethod: expose wrapped function
Raymond Hettinger rhettin...@users.sourceforge.net added the comment: I am all for exposing the __func__ directly but don't immediately see how to do it. -- assignee: rhettinger - ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue5982 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue5982] classmethod, staticmethod: expose wrapped function
Terry J. Reedy tjre...@udel.edu added the comment: Having to bind and unbind a classmethod to get at the function is definitely a bit weird, and also susceptible to changing implementation, but do you have a practical use case to motivate the effort needed? In Py3, '__func__' replaced 'im_func', and that is the name to use if the attribute is added. A change in 3.2 is at least as likely as a change in 2.7. -- nosy: +tjreedy versions: +Python 3.2 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue5982 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue5982] classmethod, staticmethod: expose wrapped function
Changes by Raymond Hettinger rhettin...@users.sourceforge.net: -- assignee: - rhettinger nosy: +rhettinger ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue5982 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue5982] classmethod, staticmethod: expose wrapped function
New submission from George Sakkis george.sak...@gmail.com: It would be nice if classmethod/staticmethod exposed the wrapped function as a read-only attribute/property. Currently the function can be retrieved indirectly but it's obscure (and perhaps not always correct, I'm not sure): In [147]: def f():pass .: In [148]: c = classmethod(f) In [149]: s = staticmethod(f) In [150]: c.__get__(1).im_func is f Out[150]: True In [151]: s.__get__(1) is f Out[151]: True -- messages: 87511 nosy: gsakkis severity: normal status: open title: classmethod, staticmethod: expose wrapped function type: feature request versions: Python 2.7 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue5982 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com