S
Steven D'Aprano
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
.... def __repr__(self):
.... s = super().__repr__()
.... return s.replace('class', 'metaclass')
........ pass
........ pass
....
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
TypeError: object.__new__() takes no parameters
What am I doing wrong?
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
.... def __repr__(self):
.... s = super().__repr__()
.... return s.replace('class', 'metaclass')
........ pass
........ pass
....
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
TypeError: object.__new__() takes no parameters
What am I doing wrong?