3 ms·
I too expected the syntax list comprehensions to chained. Turns out that nesting is a feature: http://www.python.org/dev/peps/pep-0202/ http://www.python.org/
by divtxt 15y ago
I too expected the syntax list comprehensions to chained.
Turns out that nesting is a feature:
http://www.python.org/dev/peps/pep-0202/ http://www.python.org/dev/peps/pep-0202/
- The form [... for x... for y...] nests, with the last index varying fastest, just like nested for loops.