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
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4