On Tue, Jun 5, 2012 at 2:48 AM, Steven D'Aprano <steve+comp.lang.pyt...@pearwood.info> wrote: > I was playing around with metaclasses and I wondered what would happen if > the metaclass itself had a metaclass. Sort of a metametaclass. > > Apparently it gives an error. Can anyone explain why this does not work?
In your example, Meta is not actually a metaclass, as it inherits from object, not type. Here's an example that works: >>> class MetaMeta(type): pass ... >>> class Meta(type, metaclass=MetaMeta): pass ... >>> class MyClass(metaclass=Meta): pass ... Anyway, metaclasses of metaclasses is not that unusual, as type is already its own metaclass. Cheers, Ian -- http://mail.python.org/mailman/listinfo/python-list