Skip to content

Commit

Permalink
Update the annotated assignment docs (GH-13757)
Browse files Browse the repository at this point in the history
  • Loading branch information
ilevkivskyi committed Jun 2, 2019
1 parent 3cf7ea1 commit 82eac26
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion Doc/reference/simple_stmts.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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:

Expand Down

0 comments on commit 82eac26

Please sign in to comment.