pickle problem

Hrvoje Niksic hniksic at xemacs.org
Fri May 9 05:38:56 EDT 2008


Marc 'BlackJack' Rintsch <bj_666 at gmx.net> writes:

>> Of course, if it makes sense to pickle sockets in the application, one
>> is can do so by defining __getstate__ and __setstate__:
>
> When does it make sense!?

When recreating the object from on-disk state requires reestablishing
the communication, as the example shows.  I'm not saying that doing
that is always a good idea, only that it can be done if/when needed.

> But if you unpickle it while the original connection is still open it
> can't connect.

Why not?  I was thinking "client socket", not "server socket".



More information about the Python-list mailing list