(original) (raw)
On 4/17/07, Jean-Paul Calderone <exarkun@divmod.com> wrote:
Probably not, or at least not consciously. I think the point is that 'type' and its subclasses are special enough that this warrants a separate 'X' that inherits from 'type' rather than 'object'. Reduced reusability, but how badly does this affect you in the real world, really?
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?
Probably not, or at least not consciously. I think the point is that 'type' and its subclasses are special enough that this warrants a separate 'X' that inherits from 'type' rather than 'object'. Reduced reusability, but how badly does this affect you in the real world, really?
--
Thomas Wouters <thomas@python.org>
Hi! I'm a .signature virus! copy me into your .signature file to help me spread!