aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIvan Levkivskyi <levkivskyi@gmail.com>2019-06-03 00:41:00 +0100
committerGitHub <noreply@github.com>2019-06-03 00:41:00 +0100
commit82eac26a73107ded733110cf11e59e95f41c197e (patch)
tree171082e30fb494878af4443907fa7b3799c49460 /Doc/reference
parentbpo-37100: Fix test_coroutines with -Werror (GH-13756) (diff)
downloadcpython-82eac26a73107ded733110cf11e59e95f41c197e.tar.gz
cpython-82eac26a73107ded733110cf11e59e95f41c197e.tar.bz2
cpython-82eac26a73107ded733110cf11e59e95f41c197e.zip
Update the annotated assignment docs (GH-13757)
Diffstat (limited to 'Doc/reference')
-rw-r--r--Doc/reference/simple_stmts.rst8
1 files changed, 7 insertions, 1 deletions
diff --git a/Doc/reference/simple_stmts.rst b/Doc/reference/simple_stmts.rst
index af7c0caff62..9c0430da1fb 100644
--- a/Doc/reference/simple_stmts.rst
+++ b/Doc/reference/simple_stmts.rst
@@ -329,7 +329,8 @@ Annotated assignment statements
statement, of a variable or attribute annotation and an optional assignment statement:
.. productionlist::
- annotated_assignment_stmt: `augtarget` ":" `expression` ["=" `expression`]
+ annotated_assignment_stmt: `augtarget` ":" `expression`
+ : ["=" (`expression_list` | `yield_expression`)]
The difference from normal :ref:`assignment` is that only single target and
only single right hand side value is allowed.
@@ -366,6 +367,11 @@ target, then the interpreter evaluates the target except for the last
syntax for type annotations that can be used in static analysis tools and
IDEs.
+.. versionchanged:: 3.8
+ Now annotated assignments allow same expressions in the right hand side as
+ the augmented assignments. Previously, some expressions (like un-parenthesized
+ tuple expressions) caused a syntax error.
+
.. _assert: