__slots_ and inheritance

Jim Meyer jmeyer at pdi.com
Thu Apr 10 11:14:18 EDT 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
reflection?

Thanks in advance,

--j, always looking to learn.
-- 
Jim Meyer, Geek at Large                                  jmeyer at pdi.com






More information about the Python-list mailing list