[Python-Dev] PEP 572: Assignment Expressions (original) (raw)

Steven D'Aprano steve at pearwood.info
Mon Apr 23 20:31:36 EDT 2018


On Mon, Apr 23, 2018 at 03:36:10PM -0700, Guido van Rossum wrote:

Using 'as' was debated extensively on python-ideas. I don't like it for several reasons: [...]

For what it is worth, I was one of the original proponents of the "as" syntax, but at this point I am no longer going to argue for it. I'm satisfied that using "as" has disadvantages, and that := is an acceptable alternative.

While I haven't changed my mind that putting the expression first and the target second is better, I'm satisfied that it is not so much better that it is worth extending this enormous discussion even further.

In other words, as far as I am concerned, I am happy to take the syntax as decided: "expr as name" is rejected and "name := expr" is acceptable.

I'm also satisfied that at least for now we should stick to only allowing simple names. We can always loosen the restriction later and allow arbitrarily complex targets at a later date, but we can't easily change our mind and prohibit them.

-- Steve



More information about the Python-Dev mailing list