On 30 June 2018 at 09:49, Chris Barker - NOAA Federal via Python-Dev <python-dev@python.org> wrote: >> On Jun 28, 2018, at 8:21 PM, Tim Peters <tim.pet...@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 | ncogh...@gmail.com | Brisbane, Australia _______________________________________________ Python-Dev mailing list Python-Dev@python.org https://mail.python.org/mailman/listinfo/python-dev Unsubscribe: https://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com