New submission from Stefan Mihaila <mstefa...@gmail.com>: In order to implement pickling of instance methods, a means of separating the object and the unbound method is necessary.
This is easily done for Python methods (f.__self__ and f.__func__), but not all of builtins support __func__. Moreover, there currently appears to be no good way to distinguish functions from bound methods. As a first step in solving this issue, I have attached a patch which: 1) adds __func__ for all function types 2) adds a few new definitions in the types module (AllFunctionTypes etc.) 3) adds isanyfunction(), isanyboundfunction(), isanyunboundfunction() in inspect (admittedly these are bad names) 4) functools.unbind In case applying this patch is being considered, serious review is necessary, as I'm not knowledgeable of cpython internals. ---------- components: Library (Lib) files: func.patch keywords: patch messages: 165845 nosy: mstefanro priority: normal severity: normal status: open title: Unbinding of methods type: enhancement versions: Python 3.3 Added file: http://bugs.python.org/file26438/func.patch _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue15397> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com