@@ -162,12 +162,11 @@ Common applications are to make lists where each element is the result of
162162some operations applied to each member of the sequence, or to create a
163163subsequence of those elements that satisfy a certain condition.
164164
165-
166- Each list comprehension consists of an expression followed by a :keyword: `for `
167- clause, then zero or more :keyword: `for ` or :keyword: `if ` clauses. The result
168- will be a list resulting from evaluating the expression in the context of the
169- :keyword: `for ` and :keyword: `if ` clauses which follow it. If the expression
170- would evaluate to a tuple, it must be parenthesized.
165+ A list comprehension consists of brackets containing an expression followed
166+ by a :keyword: `for ` clause, then zero or more :keyword: `for ` or :keyword: `if `
167+ clauses. The result will be a list resulting from evaluating the expression in
168+ the context of the :keyword: `for ` and :keyword: `if ` clauses which follow it. If
169+ the expression would evaluate to a tuple, it must be parenthesized.
171170
172171Here we take a list of numbers and return a list of three times each number::
173172
@@ -348,8 +347,8 @@ The reverse operation is also possible::
348347 >>> x, y, z = t
349348
350349This is called, appropriately enough, *sequence unpacking * and works for any
351- sequence on the right-hand side. Sequence unpacking requires the list of
352- variables on the left to have the same number of elements as the length of the
350+ sequence on the right-hand side. Sequence unpacking requires that there are as
351+ many variables on the left side of the equals sign as there are elements in the
353352sequence. Note that multiple assignment is really just a combination of tuple
354353packing and sequence unpacking.
355354
0 commit comments