__slots__ and metaclasses

Alex Martelli aleax at aleax.it
Thu Nov 14 15:18:53 EST 2002


Robert Ferrell wrote:

> How can I set the __slots__ attribute for a class in the classes
> metaclass?  I tried adding:
> 
>     setattr(cls, '__slots__', __slots__)
> 
> to the __init__ method in the metaclass, but that did not work.  Is
> what I'm trying to do even possible?  I've read what I could find
> about metaclasses and __slots__, and I've mostly got the metaclasses
> working for me.  But I'm stuck on this one point.  Any help/pointers

See, for example:

http://groups.google.com/groups?hl=en&selm=0qZV8.51942%24vm5.1927874%40news2.tin.it


Alex





More information about the Python-list mailing list