[Python-ideas] PEP 572: Assignment Expressions (post #4)
Chris Angelico
rosuav at gmail.com
Wed Apr 11 20:49:36 EDT 2018
On Thu, Apr 12, 2018 at 10:44 AM, Ethan Furman <ethan at stoneleaf.us> wrote:
> On 04/11/2018 04:46 PM, Chris Angelico wrote:
>
>> For myself, I've been back and forth a bit about whether "as" or ":="
>> is the better option. Both of them have problems. Both of them create
>> edge cases that could cause problems. Since the problems caused by
>> ":=" are well known from other languages (and are less serious than
>> they would be if "=" were the operator), I'm pushing that form.
>> However, the 'as' syntax is a close contender (unlike most of the
>> other contenders), so if someone comes up with a strong argument in
>> its favour, I could switch.
>
>
> While I strongly prefer "as", if it can't be made to work in the grammar
> then that option is pretty much dead, isn't it? In which case, I'll take
> ":=".
>
It can; and in fact, I have a branch where I had exactly that (with
the SLNB functionality as well):
https://github.com/Rosuav/cpython/tree/statement-local-variables
But it creates enough edge cases that I was swayed by the pro-:= lobby.
ChrisA
More information about the Python-ideas
mailing list