Commit 8bcf2629 authored by Ivan Levkivskyi's avatar Ivan Levkivskyi Committed by GitHub

More updates to the annotated assignments docs (GH-13794)

parent 4cdbc452
...@@ -330,10 +330,9 @@ statement, of a variable or attribute annotation and an optional assignment stat ...@@ -330,10 +330,9 @@ statement, of a variable or attribute annotation and an optional assignment stat
.. productionlist:: .. productionlist::
annotated_assignment_stmt: `augtarget` ":" `expression` annotated_assignment_stmt: `augtarget` ":" `expression`
: ["=" (`expression_list` | `yield_expression`)] : ["=" (`starred_expression` | `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 is allowed.
only single right hand side value is allowed.
For simple names as assignment targets, if in class or module scope, For simple names as assignment targets, if in class or module scope,
the annotations are evaluated and stored in a special class or module the annotations are evaluated and stored in a special class or module
...@@ -369,7 +368,7 @@ target, then the interpreter evaluates the target except for the last ...@@ -369,7 +368,7 @@ target, then the interpreter evaluates the target except for the last
.. versionchanged:: 3.8 .. versionchanged:: 3.8
Now annotated assignments allow same expressions in the right hand side as Now annotated assignments allow same expressions in the right hand side as
the augmented assignments. Previously, some expressions (like un-parenthesized the regular assignments. Previously, some expressions (like un-parenthesized
tuple expressions) caused a syntax error. tuple expressions) caused a syntax error.
......
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