Copy with __slots__...will it ever work?

Alex Martelli aleax at aleax.it
Fri Mar 28 12:22:32 CET 2003


Tim Peters wrote:

> [Andrew Sterian]
>> I've run up against the problem of not being able to call copy.copy()
>> on a new-style class that defines __slots__.
> 
> If you can, try current CVS Python.  Guido reworked a lot of this code
> after the 2.3a2 release, as part of our introduction of a new pickle
> protocol. New-style classes that define __slots__ can be pickled in
> current CVS Python, and copy.copy() may have inherited relevant new
> abilities too.

Absolutely correct (as could be expected from the Senior Bot, of
course) -- I just tried on a fresh-from-CVS Python 2.3, and copy.copy 
_does_ now work just fine with __slots__, AFAICS.


Alex





More information about the Python-list mailing list