Hacker News new | ask | show | jobs
by lisper 3743 days ago
It's a list comprehension with an implicit nested loop:

    >>> [y for z in [[1,2,3],[4,5,6]] for y in z]
    [1, 2, 3, 4, 5, 6]
The error you get is because "planet" is bound by the second FOR clause, so when you leave it out, planet becomes unbound.
1 comments

The term nested list comprehension is used differently here: https://docs.python.org/3/tutorial/datastructures.html#neste...

Don't know what a better term might be, but it's good to be aware of the distinction.

Good point. I fixed it.