[Python-Dev] inspect and metaclasses (original) (raw)
Antoine Pitrou solipsis at pitrou.net
Fri Sep 6 19:02:47 CEST 2013
- Previous message: [Python-Dev] inspect and metaclasses
- Next message: [Python-Dev] when to fix cross-version bugs?
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
On Fri, 06 Sep 2013 08:14:09 -0700 Ethan Furman <ethan at 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.
- Previous message: [Python-Dev] inspect and metaclasses
- Next message: [Python-Dev] when to fix cross-version bugs?
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]