guys. I\'m trying to find the most elegant solution to a problem and wondered if python has anything built-in for what I\'m trying to do.
What I\'m doing is this. I
>>> from functools import reduce
>>> listOfLists = [[1, 2],[3, 4, 5], [6]]
>>> reduce(list.__add__, listOfLists)
[1, 2, 3, 4, 5, 6]
I'm guessing the itertools solution is more efficient than this, but this feel very pythonic.
In Python 2 it avoids having to import a library just for the sake of a single list operation (since reduce is a built-in).