[Python-Dev] Accepting PEP 572, Assignment Expressions

Guido van Rossum guido at python.org
Wed Jul 11 20:10:42 EDT 2018

As anticippated, after a final round of feedback I am hereby accepting PEP
572, Assignment Expressions: https://www.python.org/dev/peps/pep-0572/

Thanks to everyone who participated in the discussion or sent a PR.

Below is a list of changes since the last post (https://mail.python.org/
pipermail/python-dev/2018-July/154557.html) -- they are mostly cosmetic so
I won't post the doc again, but if you want to go over them in detail,
here's the history of the file on GitHub: https://github.com/python/
peps/commits/master/pep-0572.rst, and here's a diff since the last posting:
https://github.com/python/peps/compare/26e6f61f...master (sadly it's
repo-wide -- you can click on Files changed and then navigate to

   - Tweaked the example at line 95-100 to use result = ... rather than return
   ... so as to make a different rewrite less feasible
   - Replaced the weak "2-arg iter" example with Giampaolo Roloda's while
   chunk := file.read(8192): process(chunk)
   - *Added prohibition of unparenthesized assignment expressions in
   annotations and lambdas*
   - Clarified that TargetScopeError is a *new* subclass of SyntaxError
   - Clarified the text forbidding assignment to comprehension loop control
   - Clarified that the prohibition on := with annotation applies to
   *inline* annotation (i.e. they cannot be syntactically combined in the
   same expression)
   - Added conditional expressions to the things := binds less tightly than
   - Dropped section "This could be used to create ugly code"
   - Clarified the example in Appendix C

Now on to the implementation work! (Maybe I'll sprint on this at the
core-dev sprint in September.)

--Guido van Rossum (python.org/~guido)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-dev/attachments/20180711/ab5c7f17/attachment.html>

More information about the Python-Dev mailing list