decorating classes with metaclass

Bengt Richter bokr at oz.net
Mon Mar 14 18:19:33 EST 2005


Just wondering whether anyone has discussed using decorator
syntax to effect metaclass processing. E.g.

    @MC
    class Foo(object):
        pass

would have the same effect as

    class Foo(object):
        __metaclass__ = MC
        pass

ISTM fairly analogous to function decoration, just
differing in the arguments passed.

Regards,
Bengt Richter



More information about the Python-list mailing list