diff options
Diffstat (limited to 'Doc/ref')
-rw-r--r-- | Doc/ref/ref5.tex | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/Doc/ref/ref5.tex b/Doc/ref/ref5.tex index 1abc6cb..f6d3b9c 100644 --- a/Doc/ref/ref5.tex +++ b/Doc/ref/ref5.tex @@ -153,7 +153,7 @@ square brackets: \begin{verbatim} list_display: "[" [listmaker] "]" -listmaker: expression ( list_iter | ( "," expression)* [","] ) +listmaker: expression ( list_for | ( "," expression)* [","] ) list_iter: list_for | list_if list_for: "for" expression_list "in" testlist [list_iter] list_if: "if" test [list_iter] @@ -164,7 +164,8 @@ by providing either a list of expressions or a list comprehension. When a comma-separated list of expressions is supplied, its elements are evaluated from left to right and placed into the list object in that order. When a list comprehension is supplied, it consists of a -single expression followed by one or more "for" or "if" clauses. In this +single expression followed by at least one "for" clause and zero or more +"for" or "if" clauses. In this case, the elements of the new list are those that would be produced by considering each of the "for" or "if" clauses a block, nesting from left to right, and evaluating the expression to produce a list element |