PEP 252: __slots__ inappropriate

Guido van Rossum guido at python.org
Thu Aug 16 03:22:30 EDT 2001


> In the current implementation of PEP 252, to declare an class with
> slots, you assign to the __slots__ variable inside the class
> definition:
> 
> class Foo(object):
>   __slots__ = ['bar','baz']
> 
> This declares that every instance of Foo will have two instance
> attributes, namely bar and baz.
> 
> I find that this way of defining class properties is inconsistent with
> the rest of the language, in particular with other "magic" class
> attributes:
[...]
> So please consider changing the slot syntax.

I suppose the same goes for __metaclass__ and __dynamic__.  In
python-dev, Ping made a similar request (add more syntax) for class
methods and static methods.  My response is the same; quoting myself:

| Understood, and agreed.  It is my plan to eventually provide syntax
| for this.  However, right now I need to concentrate on getting the
| underlying mechanisms to work.  The unification is a lot of work, and
| I'd like to finish the run-time before I start thinking about
| syntactic sugar.  I can't promise that I'll change the syntax before
| 2.2 is released -- there will be plenty of time after that, and there
| are plenty of more important things to do before I can make the
| release.

--Guido van Rossum (home page: http://www.python.org/~guido/)




More information about the Python-list mailing list