[Python-Dev] Accepting PEP 572, Assignment Expressions
Hooray! I could be a happy python oneliner now!
ZHUO QL (KDr2, http://kdr2.com)
On Thursday, July 12, 2018, 8:12:54 AM GMT+8, Guido van Rossum <guido at python.org> wrote:
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 pep-0572.rst).
- 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 variables
- 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)_______________________________________________
Python-Dev mailing list
Python-Dev at python.org
-------------- next part --------------
An HTML attachment was scrubbed...