[Python-Dev] Informal educator feedback on PEP 572 (was Re: 2018 Python Language Summit coverage, last part)
Ivan Pozdeev
vano at mail.mipt.ru
Tue Jun 26 03:41:04 EDT 2018
On 26.06.2018 0:13, Steve Holden wrote:
> On Mon, Jun 25, 2018 at 8:37 PM, Terry Reedy <tjreedy at udel.edu
> <mailto:tjreedy at udel.edu>> wrote:
>
> On 6/24/2018 7:25 PM, Guido van Rossum wrote:
>
> I'd wager that the people who might be most horrified about it
>
>
> the (b) scoping rule change
>
> would be people who feel strongly that the change to the
> comprehension scope rules in Python 3 is a big improvement,
>
>
> I might not be one of those 'most horrified' by (b), but I
> increasingly don't like it, and I was at best -0 on the
> comprehension scope change. To me, iteration variable assignment
> in the current scope is a non-problem. So to me the change was
> mostly useless churn. Little benefit, little harm. And not worth
> fighting when others saw a benefit.
>
> However, having made the change to nested scopes, I think we
> should stick with them. Or repeal them. (I believe there is
> another way to isolate iteration names -- see below). To me, (b)
> amounts to half repealing the nested scope change, making
> comprehensions half-fowl, half-fish chimeras.
>
> [...]
>
> --
> Terry Jan Reedy
>
> I'd like to ask: how many readers of
> this email have ever deliberately taken advantage of the limited
> Python 3 scope in comprehensions and generator expressions to use what
> would otherwise be a conflicting local variable name?
I did:
for l in (l.rstrip() for l in f):
The provisional unstripped line variable is totally unneeded in the
following code.
>
> I appreciate that the scope limitation can sidestep accidental naming
> errors, which is a good thing.
>
> Unfortunately, unless we anticipate Python 4 (or whatever) also making
> for loops have an implicit scope, I am left wondering whether it's not
> too large a price to pay. After all, special cases aren't special
> enough to break the rules, and unless the language is headed towards
> implicit scope for all uses of "for" one could argue that the scope
> limitation is a special case too far. It certainly threatens to be yet
> another confusion for learners, and while that isn't the only
> consideration, it should be given due weight.
>
>
> _______________________________________________
> Python-Dev mailing list
> Python-Dev at python.org
> https://mail.python.org/mailman/listinfo/python-dev
> Unsubscribe: https://mail.python.org/mailman/options/python-dev/vano%40mail.mipt.ru
--
Regards,
Ivan
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-dev/attachments/20180626/dbfc0e7d/attachment-0001.html>
More information about the Python-Dev
mailing list