Hacker News new | past | comments | ask | show | jobs | submit login

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»].



Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: