New classes, __slots__, __dict__

Philip Swartzleonard starx at pacbell.net
Sat Apr 13 05:50:47 EDT 2002


Just van Rossum || Sat 13 Apr 2002 01:38:17a:

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

Er... I thought the fact that it WAS mutible was an error somehow...

-- 
Philip Sw "Starweaver" [rasx] :: www.rubydragon.com



More information about the Python-list mailing list