[Python-ideas] PEP 3155 - Qualified name for classes and functions

Jan Kaliszewski zuo at chopin.edu.pl
Sat Nov 5 00:15:23 CET 2011


Guido van Rossum dixit (2011-11-04, 13:49):

> On Fri, Nov 4, 2011 at 12:38 PM, Antoine Pitrou <solipsis at pitrou.net> wrote:
> > On Sun, 30 Oct 2011 09:52:15 +1000
> > Nick Coghlan <ncoghlan at gmail.com> wrote:
[snip]
> >> For nested functions, I suggest adding something to the qname to
> >> directly indicate that the scope is hidden. Adding parentheses to the
> >> name of the outer function would probably work:
> >>
> >>     f().g
> >
> > I don't know, I find the "()" a bit too smart. I'd like Guido's
> > advice on the matter.
> 
> Hm. Both 'f.g' and 'f().g' for f().__qname__ are misleading, since both
> look like valid expressions but neither will actually retrieve the intended
> object. I'd be tempted to return something like '<local in f>.g' where 'f'
> would be f.__qname__. And yes, if f.__qname__ were '<local in xyzzy>.f',
> then f().__qname__ should be '<local in <local in xyzzy>.f>.g'.
> 
> Alternatively perhaps I could live with 'f.<locals>.g' and
> 'xyzzy.<locals>.f.<locals>.g'.

And what about:

    <f locals>.g
and
    <<xyzzy locals>.f locals>.g

Cheers.
*j




More information about the Python-ideas mailing list