a question on __slots__ (and example from Nutshell)
Porky Pig Jr
porky_pig_jr at my-deja.com
Thu Jun 3 22:04:06 CEST 2004
"Ixokai" <usenet at ixokai.net> wrote in message news:<10btllha2p1vh97 at corp.supernews.com>...
> *blink* That's interesting.
> I've never tried to add __slots__ to 'optimize' a parent like that. It
> doesn't actually surprise me that a child inherits everything with its
> parent-- including the dictionary since one is there. And if one is there,
> it doesn't surprise me that you can assign arbitrary attributes to it.
> Its nothing I was aware of-- but it doesn't surprise me. I wouldn't expect
> having __slots__ there to go in and remove something that was present in a
> parent class.
Well, the fact is that the whole example is from 'Python in a
nutshell', by Alex Martelli, 2003 edition, should be pretty much up to
date, unless of course something got changed between the time this
book was written (probably some earlier version of 2.3 was already in
place) and the current release (2.3.3+), or the whole example is
I'll try to contact the author directly.
More information about the Python-list