PEP 252: __slots__ inappropriate

James_Althoff at i2.com James_Althoff at i2.com
Thu Aug 16 19:53:43 CEST 2001


I think Guido is doing exactly the right thing: get the functionality to
work well first.  Then it will be easier to propose and experiment with
different forms of syntax later.

Jim



                                                                                                                   
                    Guido van Rossum                                                                               
                    <guido at python.org>        To:     python-list at python.org                                       
                    Sent by:                  cc:                                                                  
                    python-list-admin@        Subject:     Re: PEP 252: __slots__ inappropriate                    
                    python.org                                                                                     
                                                                                                                   
                                                                                                                   
                    08/16/01 12:22 AM                                                                              
                                                                                                                   
                                                                                                                   




> 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/)

--
http://mail.python.org/mailman/listinfo/python-list








More information about the Python-list mailing list