4 ms·
Your second example is easier to just write as: >>> from itertools import chain >>> list_of_lists = [['a', 'b', 'c'], ['d', 'e', 'f']] >>> list(chain(*li
by jacobolus 16y ago
Your second example is easier to just write as:
>>> from itertools import chain
>>> list_of_lists = [['a', 'b', 'c'], ['d', 'e', 'f']]
>>> list(chain(*list_of_lists))
['a', 'b', 'c', 'd', 'e', 'f']
That is, list(«foo») is clearer and more idiomatic than [x for x in «foo»].