Update the annotated assignment docs (GH-13757)

This commit is contained in:
Ivan Levkivskyi 2019-06-03 00:41:00 +01:00 committed by GitHub
parent 3cf7ea1272
commit 82eac26a73
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 7 additions and 1 deletions

View File

@ -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: