Re: [Python-Dev] inspect and metaclasses

2013-09-06 Thread Antoine Pitrou
On Fri, 06 Sep 2013 08:14:09 -0700 Ethan Furman 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 Py

Re: [Python-Dev] inspect and metaclasses

2013-09-06 Thread R. David Murray
On Fri, 06 Sep 2013 10:01:32 -0700, Ethan Furman wrote: > On 09/06/2013 09:37 AM, R. David Murray wrote: > > On Fri, 06 Sep 2013 08:59:02 -0700, Ethan Furman wrote: > >> > >> For the short term I can restrict the change to > >> inspect.classify_class_attrs(). > > > > Sounds like the best course.

Re: [Python-Dev] inspect and metaclasses

2013-09-06 Thread Ethan Furman
On 09/06/2013 09:37 AM, R. David Murray wrote: On Fri, 06 Sep 2013 08:59:02 -0700, Ethan Furman wrote: For the short term I can restrict the change to inspect.classify_class_attrs(). Sounds like the best course. There is one other function in inspect that calls getmro(): def getmembers(ob

Re: [Python-Dev] inspect and metaclasses

2013-09-06 Thread R. David Murray
On Fri, 06 Sep 2013 08:59:02 -0700, Ethan Furman wrote: > On 09/06/2013 08:44 AM, R. David Murray wrote: > > On Fri, 06 Sep 2013 08:14:09 -0700, Ethan Furman wrote: > >> On 09/06/2013 07:47 AM, Armin Rigo wrote: > >>> > >>> Are you suggesting that inspect.getmro(A) would return (A, object, > >>>

Re: [Python-Dev] inspect and metaclasses

2013-09-06 Thread Ethan Furman
On 09/06/2013 08:44 AM, R. David Murray wrote: On Fri, 06 Sep 2013 08:14:09 -0700, Ethan Furman 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

Re: [Python-Dev] inspect and metaclasses

2013-09-06 Thread R. David Murray
On Fri, 06 Sep 2013 08:14:09 -0700, Ethan Furman 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)`. Which matches A.__mro_

Re: [Python-Dev] inspect and metaclasses

2013-09-06 Thread Ethan Furman
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 thin

Re: [Python-Dev] inspect and metaclasses

2013-09-06 Thread Armin Rigo
Hi Ethan, Are you suggesting that inspect.get_mro(A) would return (A, object, type)? That seems very wrong to me. If the goal is to fix `inspect.classify_class_attrs()`, then this function only needs a specific fix, along the lines of looking in `get_mro(A) + get_mro(type(A))`. (A more minor is

[Python-Dev] inspect and metaclasses

2013-09-06 Thread Ethan Furman
Part of the fix for issue #18693 is to fix inspect to look in the metaclass for class attributes (http://bugs.python.org/issue18929). In inspect.py in function get_mro() we can either add the metaclass unconditionally, or only if it is not 'type'. If we add unconditionally, then help() adds t