a type without a __mro__?

Alex Martelli aleaxit at yahoo.com
Sun Feb 6 02:57:30 EST 2005


John Lenton <john at grulic.org.ar> wrote:

>     class C(type):
>       def __getattribute__(self, attr):
>         if attr == '__mro__':
>           raise AttributeError, "What, *me*, a __mro__? Nevah!"
>         return super(C, self).__getattribute__(attr)
> 
>     class D(object):
>       __metaclass__ = C

Yay -- *exactly*!!!  This simple trick reproduces the problem AND shows
that using inspect.getmro fixes it.  EXACTLY what we needed.  Thanks!!!
Now I can make a proper patch with unittest as well as the fix.


Alex



More information about the Python-list mailing list