Use of __slots__

Don Taylor nospamformeSVP at gmail.com
Mon Feb 27 09:42:11 EST 2006


Steve Juranich wrote:

> I might be a little confused about a couple of things (I'm sure many will
> correct me if I'm not), but as I understand it the __slots__ attribute is a
> class-attribute, which means it cannot be modified by an instance of the
> class (think of a "static" class member, if you know C++).
> 
Interesting, actually I was only doing this while noodling around trying 
to learn Python.

Does Python have the notion of static class attributes?

Just what was going on when I redefined my __slots__ attribute?

It looks as if __slots__ is something really special, or I am managing 
to hide the original __slots__ value in my __init__ method but not 
really overriding its effect.

Don.





More information about the Python-list mailing list