[Python-Dev] Pickle implementation questions
Bruce Christensen
t-bruch at microsoft.com
Fri Jun 30 19:16:54 CEST 2006
More information about the Python-Dev mailing list
Fri Jun 30 19:16:54 CEST 2006
- Previous message: [Python-Dev] Pickle implementation questions
- Next message: [Python-Dev] Pickle implementation questions
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Thanks for your responses, Martin! Martin v. Löwis wrote: > Bruce Christensen wrote: > > - Where are object.__reduce__ and object.__reduce_ex__ defined, and how > > does copy_reg._reduce_ex fit into the picture? > > See > > http://docs.python.org/lib/node69.html So just to be clear, is it something like this? class object: def __reduce__(self): return copy_reg._reduce_ex(self, -1) def __reduce_ex__(self, protocol): return copy_reg._reduce_ex(self, protocol) Does _reduce_ex's behavior actually change depending on the specified protocol version? The only difference that I can see or think of is that an assert causes it to fail if the protocol is >= 2. > > - What does copy_reg.constructor() do? > > It does this: > > def constructor(object): > if not callable(object): > raise TypeError("constructors must be callable") So it is part of the public interface? It's exported in __all__, but it appears that it's undocumented. Thanks, --Bruce
- Previous message: [Python-Dev] Pickle implementation questions
- Next message: [Python-Dev] Pickle implementation questions
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-Dev mailing list