New classes, __slots__, __dict__

Just van Rossum just at xs4all.nl
Sat Apr 13 04:38:17 EDT 2002


In article <mailman.1018639826.18289.python-list at python.org>,
 Tim Peters <tim.one at comcast.net> wrote:

> 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.

Is making __slots__ immutable no solution? Seems almost too easy...

Just



More information about the Python-list mailing list