[Python-Dev] new metaclass error condition checks (original) (raw)

Jean-Paul Calderone exarkun at divmod.com
Tue Apr 17 00:53:20 CEST 2007


I just noticed r53997 (from some unit tests it broke), which disallowed things like this:

class X(object):
    def __repr__(self):
        return "blah"

class Y(X, type):
    pass

class Z:
    __metaclass__ = Y

Making X classic eliminates the TypeError, and is probably an acceptable fix in a lot of cases (at least as long as classic classes are available). I wonder if the ability to override type special methods like this was considered when the change was made, though?

Jean-Paul



More information about the Python-Dev mailing list