[issue9276] pickle should support methods

Ram Rachum report at bugs.python.org
Tue Mar 1 22:03:19 CET 2011


Ram Rachum <cool-rr at cool-rr.com> added the comment:

> [...]  try to whip up a patch and upload it if it ends up not too hackish.

To have a non-hackish patch we need a non-hackish idea. The `.__parent_class__` idea looks hackish to me, but now that I think about it, how is it more hackish than a function's `.__module__` attribute?

I mean, a function's `.__module__` attribute says on which module the function was originally defined, but the function could be accessible on any other module and any other namespace or class. Its `.__module__` would remain constant, because it's the one place where you are guaranteed to be able to find the function, assuming it's defined in the top-level. So the `.__module__` attribute is used in unpickling the function. How is the `.__parent_class__` suggestion more hackish than `.__module__`?

----------

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue9276>
_______________________________________


More information about the Python-bugs-list mailing list