parameterized metaclass (or metametaclass)

michele.simionato at gmail.com michele.simionato at gmail.com
Thu Jan 6 10:15:20 EST 2005


> I was wondering if there is some simpler way of building
parameterized
> metaclasses ?

Why not just a function returning metaclasses?

def metaFactory(*args):
dic = <something possibly depending on args>
return type("somemetaclass", (type,), dic)

Alternatively, a metaclass classmethod returning a metaclass, so that
you can use something like

__metaclass__ = MyMetaclass.with(*args) # classmethod returning a
metaclass

         Michele Simionato




More information about the Python-list mailing list