News for hackers. Stuff that matters.
Re:Ruby and Python: pivot points by jacobolus on Saturday January 22, 2011 @07:46PM (#2131484)
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»].

There are no comments on this comment yet.