[Python-Dev] Informal educator feedback on PEP 572 (was Re: 2018 Python Language Summit coverage, last part)
Nick Coghlan
ncoghlan at gmail.com
Sat Jun 30 04:30:56 EDT 2018
On 30 June 2018 at 09:49, Chris Barker - NOAA Federal via Python-Dev
<python-dev at python.org> wrote:
>> On Jun 28, 2018, at 8:21 PM, Tim Peters <tim.peters at gmail.com> wrote:
>
> Seems it’s all been said, and Tim’s latest response made an excellent
> case for consistency.
>
> But:
>
>> Regardless of how assignment expressions work in listcomps and genexps, this example (which uses neither) _will_ rebind the containing block's `x`:
>>
>> [x := 1]
>
> This reinforces my point that it’s not just about comprehensions, but
> rather that the local namespace can be altered anywhere an expression
> is used — which is everywhere.
>
> That trivial example is unsurprising, but as soon as your line of code
> gets a bit longer, it could be far more hidden.
The significant semantic differences between "{x : 1}" and "{x := 1}"
are also rather surprising :)
Cheers,
Nick.
--
Nick Coghlan | ncoghlan at gmail.com | Brisbane, Australia
More information about the Python-Dev
mailing list