[Python-Dev] Pickle implementation questions (original) (raw)
Bruce Christensen t-bruch at microsoft.com
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.reduceex defined, and how > does copyreg.reduceex fit into the picture?
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 copyreg.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 ]