[Python-Dev] PEP for Better Control of Nested Lexical Scopes
Jeremy Hylton
jeremy at alum.mit.edu
Tue Feb 21 20:25:06 CET 2006
On 2/21/06, Terry Reedy <tjreedy at udel.edu> wrote:
>
> "Almann T. Goo" <almann.goo at gmail.com> wrote in message
> news:7e9b97090602210516o5d1a823apedcea66846a271b5 at mail.gmail.com...
>
> > I certainly hope that an initiative like this doesn't get stymied by
> > the lack of a good name for such a keyword. Maybe something like
> > "outer"?
>
> Adding a keyword has a cost that you have so far ignored. Guido is
> rightfully very cautious about additions, especially for esthetic reasons.
>
> The issue of rebinding enclosed names was partly discussed in PEP 227.
> Sometime after the implementation of the PEP in 2.1, it was thoroughly
> discussed again (100+ posts?) in this forum. There were perhaps 10
> different proposals, including, I believe, 'outer'. Guido rejected them
> all as having costs greater than the benefits. Perhaps you can find this
> discussion in the archives. I remember it as a Jan-Feb discussion but
> might be wrong.
If I recall the discussion correctly, Guido said he was open to a
version of nested scopes that allowed rebinding. Not sure that the
specifics of the previous discussion are necessary, but I recall being
surprised by the change in opinion since 2.1 :-).
Jeremy
>
> This thread so far seems like a rehash of parts of the earlier discussion.
> In the absence of indication from Guido that he is ready to reopen the
> issue, perhaps it would better go to comp.lang.python. In and case,
> reconsideration is more likely to be stimulated by new experience with
> problems in real code than by repeats of 'orthogonality' desires and
> rejected changes.
>
> ---
>
> In another post, you rejected the use of class instances by opining:
>
> >Because I think that this is a workaround for a concept that the
> >language doesn't support elegantly with its lexically nested scopes.
>
> >IMO, you are emulating name rebinding in a closure by creating an
> >object to encapsulate the name you want to rebind
>
> Guido, on the other hand, views classes and instances as Python's method of
> doing what other (functional) languages do with closures. From the PEP:
> "Given that this
> would encourage the use of local variables to hold state that is
> better stored in a class instance, it's not worth adding new
> syntax to make this possible (in Guido's opinion)."
> He reiterated this viewpoint in the post-PEP discussion mentioned above. I
> think he would specificly reject the view that Python's alternative is a
> 'workaround' and 'emulation' of what you must consider to be the real
> thing.
>
> Terry Jan Reedy
>
>
>
>
> _______________________________________________
> Python-Dev mailing list
> Python-Dev at python.org
> http://mail.python.org/mailman/listinfo/python-dev
> Unsubscribe: http://mail.python.org/mailman/options/python-dev/jeremy%40alum.mit.edu
>
More information about the Python-Dev
mailing list