On Fri, 06 Sep 2013 08:14:09 -0700
Ethan Furman <et...@stoneleaf.us> wrote:
> On 09/06/2013 07:47 AM, Armin Rigo wrote:
> >
> > Are you suggesting that inspect.getmro(A) would return (A, object,
> > type)?  That seems very wrong to me.
> 
> Currently, `inspect.getmro(A)` returns `(A, object)`.
> 
> Considering that Python actually will look in A's metaclass to find a class 
> attribute, I think returning `(A, object, 
> type(A)` is appropriate:

No, I don't think it's appropriate at all. You are conflating two
things:
- the instance lookup of an attribute (on A, here)
- the class lookup when the instance lookup fails (on type, here)

Both lookups obey the same MRO rules, it just happens that the
second lookup uses a trivial MRO:

>>> type.__mro__
(<class 'type'>, <class 'object'>)


Regards

Antoine.


_______________________________________________
Python-Dev mailing list
Python-Dev@python.org
https://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
https://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com

Reply via email to