Pickling slotted instances

David Mertz, Ph.D. mertz at gnosis.cx
Sun Sep 15 14:28:12 EDT 2002


|Instances using __slots__ can't be pickled - is there a fundemental
|reason why this is so, or is it simply yet to be implemented?

Plug of the week:  My gnosis.xml.pickle package will handle instances
that have __slots__ (even those lacking __getstate__()/__setstate__()).
While the package does "the right thing" IMO, this particular bit isn't
guaranteed to remain the same, depending on what future versions of
[c]Pickle decide to do.  Then again, none of the other bits are
-guaranteed- to remain the same in later versions either. :-)

Feel free to use it, steal the code (it's public domain), just look for
inspiration, etc:

    http://gnosis.cx/download/Gnosis_Utils-current.tar.gz


--
mertz@  | The specter of free information is haunting the `Net!  All the
gnosis  | powers of IP- and crypto-tyranny have entered into an unholy
.cx     | alliance...ideas have nothing to lose but their chains.  Unite
        | against "intellectual property" and anti-privacy regimes!
-------------------------------------------------------------------------





More information about the Python-list mailing list