Possible bug in "metaclass resolution order" ?

Pedro Werneck pedro.werneck at terra.com.br
Sat Sep 17 11:41:09 EDT 2005


On 17 Sep 2005 02:04:39 -0700
"Simon Percivall" <percivall at gmail.com> wrote:

> Have you read the "Metaclasses" part of "Unifying types and classes in
> Python 2.2"? (http://www.python.org/2.2.3/descrintro.html#metaclasses)

Yes, I read. Have you read and understood my message ? :)

A class B, subclass of class A, with a metaclass M_A should have M_A or
a subclass of it as metaclass. If you try with anything else, you get a
TypeError exception as expected. OK. But if you try with 'type', nothing
happens. 

Python 2.4.1 (#1, Sep 16 2005, 17:47:47) 
[GCC 3.3.4] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> class M_A(type): pass
... 
>>> class A: __metaclass__ = M_A
... 
>>> class B(A): __metaclass__ = type
... 
>>> B.__class__
<class '__main__.M_A'>
>>> B.__metaclass__
<type 'type'>


Regards,

-- 
Pedro Werneck



More information about the Python-list mailing list