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? # Python 3.2 >>> class MyType(type): # A metaclass... ... def __repr__(self): ... s = super().__repr__() ... return s.replace('class', 'metaclass') ... >>> class Meta(metaclass=MyType): # ... of a metaclass. ... pass ... >>> Meta <metaclass '__main__.Meta'> >>> >>> isinstance(Meta, type) True >>> >>> >>> class MyClass(metaclass=Meta): # And now try to use it. ... pass ... Traceback (most recent call last): File "<stdin>", line 1, in <module> TypeError: object.__new__() takes no parameters What am I doing wrong? -- Steven -- http://mail.python.org/mailman/listinfo/python-list