New classes, __slots__, __dict__
Tim Peters
tim.one at comcast.net
Fri Apr 12 15:28:56 EDT 2002
[David Mertz, Ph.D., wonders about __slots__ versus pickling]
[Michael Hudson, points to
http://mail.python.org/pipermail/python-dev/2002-February/020072.html
http://mail.python.org/pipermail/python-dev/2002-February/020129.html
]
Another link:
http://www.python.org/sf/520644
That's bug report "[520644] __slots__ are not pickled". The short course is
that someclass.__slots__ is unreliable because mutable, and so how to find
all the actual slots in all the classes (direct and base) by magic is
something of a puzzle and/or PITA. Unless/until that does get done by
magic, you need to define a __getstate__ to spell out which slots do and
don't want to be pickled.
More information about the Python-list
mailing list