__slots__ and metaclasses

Robert Ferrell ferrell at diablotech.com
Thu Nov 14 14:24:49 EST 2002


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
will be greatly appreciated.

thanks,
-robert



More information about the Python-list mailing list