8

What is the cleanest way to implement the following:

list = [list1, list2, ...]
return [*list1, *list2, ...]

It looks like this syntax will be available in Python 3.5. In the meantime, what is your solution?

Eric Kaschalk
  • 369
  • 1
  • 4
  • 8

1 Answers1

31

This is commonly written as:

[x for l in list for x in l]
Lynn
  • 10,425
  • 43
  • 75