Steven Bethard wrote: > How are you doing it currently? Here's a sort of minimalist option: > > >>> class weeble(object): > ... def __metaclass__(name, bases, bodydict): > ... cls = type(name, bases, bodydict) > ... cls.wumpus = 'brinjal', cls > ... return cls > ... > >>> weeble.wumpus > ('brinjal', <class '__main__.weeble'>) > > Of course, it still takes four lines and a metaclass...
Well, 'type' is a metaclass, yes, but not a custom metaclass, so I would say that you are using the metaclass hook here, but not a "real" metaclass. Still waiting for class decorators ... Michele Simionato -- http://mail.python.org/mailman/listinfo/python-list