__slots_ and inheritance
jmeyer at pdi.com
Thu Apr 10 17:14:18 CEST 2003
On Thu, 2003-04-10 at 06:39, Alexander Schmolck wrote:
> I'd recommend against using __slots__ (unless really needed for optimization),
> because it cripples the usefulness and generality of your classes to your and
> also *to other people's* code (weakrefs, pickling, reflection -- all
> compromised). The first two you could fix (but are unlikely to, unless you
> *yourself* need to use weakrefs or pickling of instances of those classes),
> the last one you can't.
I'm feeling very slow this morning; could you give a few explicit
examples of how __slots__ interferes with weakrefs, pickling, and
Thanks in advance,
--j, always looking to learn.
Jim Meyer, Geek at Large jmeyer at pdi.com
More information about the Python-list