Copy with __slots__...will it ever work?

Andrew Sterian andrewsterian at yahoo.com
Thu Mar 27 20:45:07 EST 2003


I've run up against the problem of not being able to call copy.copy()
on a new-style class that defines __slots__. I found the thread that
discussed this briefly from 09-2002, but I don't understand the
responses. Well, I understand the responses (mostly) but they all
involve writing special code to make copy.copy() work again.

So I would appreciate a little education from someone who has the
time:

* Will copy.copy() ever work with __slots__? Is it in the pipe for a
future
  version?

* If not, why not? Is there a good technical reason? or just not
enough demand?

IMHO, the ideas of slots and copying a class are orthogonal, so I
don't see why it shouldn't be as easy as just calling copy.copy() and
having it work. In other words, what does restricting attribute access
have to do with copying those attributes?




More information about the Python-list mailing list