|
|
|
|
|
by jamesdutc
4480 days ago
|
|
So that flattening can also be written as: x = [[1,2], [3,4], [5,6]]
[x for x in x for x in x]
More perversely, we can also flatten with my invention: list(None for x in x if (yield from x) and False) # Python >=3.3
More reasonably, of course, list(itertools.chain.from_iterable(x))
|
|