Add pending acceptance note and some TODOs

This commit is contained in:
Guido van Rossum 2018-07-05 17:21:28 -07:00
parent 0440c6d4f7
commit 5232173ad6
1 changed files with 15 additions and 0 deletions

View File

@ -17,6 +17,15 @@ Abstract
This is a proposal for creating a way to assign to variables within an
expression using the notation ``NAME := expr``.
Pending Acceptance
------------------
This PEP will be accepted, however it needs some editing for clarity
and exact specification. A final draft will be posted to python-dev.
Note that alternate syntax proposals ("EXPR as NAME", "EXPR given
...") are no longer under consideration. Hopefully the final draft
will be posted well before the end of July 2018.
Rationale
=========
@ -235,6 +244,8 @@ above scope rules as illustrated by ``[i := i+1 for i in range(5)]``
or ``[[(j := j) for i in range(5)] for j in range(5)]``. Note that
this exception also applies to ``[i := 0 for i, j in stuff]``.)
TODO: prohibit [... for i in i := ...]
A further exception applies when an assignment expression occurrs in a
comprehension whose containing scope is a class scope. If the rules
above were to result in the target being assigned in that class's
@ -248,6 +259,10 @@ this special case may be removed from the specification of assignment
expressions. Note that the problem already exists for *using* a
variable defined in the class scope from a comprehension.)
TODO: nested comprehensions
TODO: use a a subclass of SyntaxError for various prohibitions?
Relative precedence of ``:=``
-----------------------------