[Python-ideas] PEP 3155 - Qualified name for classes and functions
Guido van Rossum
guido at python.org
Sat Nov 5 01:58:05 CET 2011
On Fri, Nov 4, 2011 at 4:15 PM, Jan Kaliszewski <zuo at chopin.edu.pl> wrote:
> 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
>
In the end I like the non-nested version better.
--
--Guido van Rossum (python.org/~guido)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20111104/e90169bf/attachment.html>
More information about the Python-ideas
mailing list