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

Guido van Rossum guido at python.org
Mon Nov 28 00:35:36 CET 2011


And, lest this becomes proof by authority, let me point out that the
<f locals> and <local g> notations are inconsistent, since at other
positions in tha actual name is between the dots (or at least has a
dot or the end of the string on each side).

--Guido

On Sun, Nov 27, 2011 at 2:05 PM, Nick Coghlan <ncoghlan at gmail.com> wrote:
> No, Guido already accepted the PEP with the existing spelling.
>
> --
> Nick Coghlan (via Gmail on Android, so likely to be more terse than usual)
>
> On Nov 28, 2011 7:34 AM, "Roman Evstifeev" <someuniquename at gmail.com> wrote:
>>
>> On Sat, Nov 5, 2011 at 9:01 PM, Ron Adam <ron3200 at gmail.com> wrote:
>> > On Sat, 2011-11-05 at 11:04 -0600, Eric Snow wrote:
>> >> On Sat, Nov 5, 2011 at 10:32 AM, Éric Araujo <merwok at netwok.org> wrote:
>> >> > Hi,
>> >> >
>> >> >> I would like to propose the following PEP for discussion and, if
>> >> >> possible, acceptance. I think the proposal shouldn't be too
>> >> >> controversial (I find it quite simple and straightforward myself
>> >> >> :-)).
>> >> >> [snip PEP]
>> >> >
>> >> > +1.
>> >> >
>> >> > For nested functions, I too think that 'f.<locals>.g' has too many
>> >> > dots;
>> >> > I like '<local in f>.g' or '<f locals>.g'.
>> >>
>> >> I like it too but don't think it's too many dots.
>> >>
>> >> The function from which the locals came _could_ be rolled into the
>> >> brackets.  However, in the context of some object (like the class X to
>> >> which f belongs), 'X.f.<locals of f>.g' makes more sense in that case
>> >> than 'X.<locals of f>.g', since the locals is related to f and not X.
>> >> But, then the f is sort of redundant, so you go back to
>> >> 'X.f.<locals>.g', and '<locals>' is still sort of unambiguous.
>> >>
>> >> The disconnect is that <locals> is an externally anonymous namespace
>> >> resulting from a call, rather than bound to any external namespace
>> >> (like an object).  Perhaps it would be appropriate to use
>> >> 'X.f().<locals>.g' to make that clear.
>> >
>> > I think if you consider locals in f as an implementation detail of f's
>> > name space rather than a sub item of f, it's not as confusing.  It's
>> > better to think of locals as being part of f, rather than in f.  That is
>> > why <f locals> makes more sense than f.<locals>.  For example locals is
>> > in f's frame object, so if you follow that reasoning you get.
>> > f.<frame>.<locals>,  but I don't think we need all that.
>> >
>> > Hmmm...  I think it actually should be spelled...
>> >
>> >      f.<local g>
>> >
>> > Following a pattern of...
>> >
>> >      x                 object x
>> >      x.f               f in object x
>> >      x.f.<local g>     local g in f in x
>> >
>> > That's both clear and concise.
>> >
>> > Cheers,
>> >   Ron
>> > _______________________________________________
>> > Python-ideas mailing list
>> > Python-ideas at python.org
>> > http://mail.python.org/mailman/listinfo/python-ideas
>> >
>>
>> May i bikeshed a bit more please?
>>
>> +1 to Ron
>>
>> 1)   C.f.<locals>.g
>> 2)   C.<f locals>.g
>> 3)   C.f.<local g>
>> I think less verbose and confusing is variant 3
>> _______________________________________________
>> Python-ideas mailing list
>> Python-ideas at python.org
>> http://mail.python.org/mailman/listinfo/python-ideas
>
> _______________________________________________
> Python-ideas mailing list
> Python-ideas at python.org
> http://mail.python.org/mailman/listinfo/python-ideas
>
>



-- 
--Guido van Rossum (python.org/~guido)



More information about the Python-ideas mailing list