[Python-porting] Pickling unbound methods on Python 3

cool-RR cool-rr at cool-rr.com
Sun May 30 13:02:49 CEST 2010


On Sun, May 30, 2010 at 12:58 PM, Lennart Regebro <regebro at gmail.com> wrote:

> On Sun, May 30, 2010 at 12:52, cool-RR <cool-rr at cool-rr.com> wrote:
> > On Sun, May 30, 2010 at 12:50 PM, Lennart Regebro <regebro at gmail.com>
> wrote:
> >>
> >> On Sun, May 30, 2010 at 12:00, cool-RR <cool-rr at cool-rr.com> wrote:
> >> > I don't understand what the problem is with just looking in the
> classes
> >> > defined in the module:
> >>
> >> How do you handle name conflicts?
> >
> > Can you specify which kind of naming conflict you mean?
>
> Two methods with the same name but in different classes would get a
> name class. They would be unpickled as the same method, leading to a
> lot of really hairy debugging. Especially if they take the same
> parameters, which seems likely in your case. You would simply unpickle
> and call the wrong method, with no errors, just unexpected behavior.
>

I don't understand how that would happen. The code that I gave confirms that
the function found inside the class `is` the function that is being pickled,
so if it finds a different function with the same name, it will ignore it.
Or maybe I'm misunderstanding something?



> Or in other words: Your solution is way more hackish and brittle than
> the one Martin suggested, which is simple, neat and Pythonic.


I disagree, Lennart.


Ram.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-porting/attachments/20100530/740c2765/attachment-0001.html>


More information about the Python-porting mailing list