Commit 82eac26a authored by Ivan Levkivskyi's avatar Ivan Levkivskyi Committed by GitHub

Update the annotated assignment docs (GH-13757)

parent 3cf7ea12
...@@ -329,7 +329,8 @@ Annotated assignment statements ...@@ -329,7 +329,8 @@ Annotated assignment statements
statement, of a variable or attribute annotation and an optional assignment statement: statement, of a variable or attribute annotation and an optional assignment statement:
.. productionlist:: .. 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 The difference from normal :ref:`assignment` is that only single target and
only single right hand side value is allowed. only single right hand side value is allowed.
...@@ -366,6 +367,11 @@ target, then the interpreter evaluates the target except for the last ...@@ -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 syntax for type annotations that can be used in static analysis tools and
IDEs. 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: .. _assert:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment