Types and Tailcalls

List tricks in Python

published on December 16th, 2011

Flattening a list of lists

>>> sum([[1],[2],[3],[4]], [])
[1,2,3,4]

Transposing a list of lists

>>> zip(*[[1,2],[3,4]])
[(1,3),(2,4)]

comments powered by Disqus