Does Python really follow its philosophy of "Readability counts"?

Marc 'BlackJack' Rintsch bj_666 at gmx.net
Mon Jan 12 11:53:07 EST 2009


On Mon, 12 Jan 2009 07:42:47 -0800, bieffe62 wrote:

> On 12 Gen, 14:45, Paul Rubin <http://phr...@NOSPAM.invalid> wrote:
>> bieff... at gmail.com writes:
>> > >    class Foo (DynamicAttributes, object): pass
>>
>> > You cannot do that, but you can establish a fixed set of attributes
>> > by defining the __slot__ class variable.
>>
>> That is not what __slot__ is for.
> 
> 
> Really? It seems to work:

It works but it is not what `__slot__` was invented for.  Some call it a 
misuse of that feature if you use it to prevent adding attributes 
dynamically.  And it has some drawbacks when you inherit from such 
classes.

Ciao,
	Marc 'BlackJack' Rintsch



More information about the Python-list mailing list