[docs] [issue13549] Incorrect nested list comprehension documentation
Mark Dickinson
report at bugs.python.org
Thu Dec 8 14:16:52 CET 2011
Mark Dickinson <dickinsm at gmail.com> added the comment:
Isn't the documentation that you refer to about *nested* list comprehensions, rather than list comprehensions with multiple 'for' clauses?
E.g.,:
[number for row in matrix for number in row]
is not a nested list comprehension: it's merely a list comprehension with two 'for' clauses. But:
[[number for number in row] for row in matrix]
*is* a nested list comprehension (a list comprehension for which the initial expression is itself a list comprehension), and there the advice to read from right to left seems to make sense to me.
----------
nosy: +mark.dickinson
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue13549>
_______________________________________
More information about the docs
mailing list