Given: a list of lists, such as [[3,2,1], [3,2,1,4,5], [3,2,1,8,9], [3,2,1,5,7,8,9]]
[[3,2,1], [3,2,1,4,5], [3,2,1,8,9], [3,2,1,5,7,8,9]]
Todo: Find the longest common
I am not sure how pythonic it is
from itertools import takewhile,izip x = [[3,2,1], [3,2,1,4,5], [3,2,1,8,9], [3,2,1,5,7,8,9]] def allsame(x): return len(set(x)) == 1 r = [i[0] for i in takewhile(allsame ,izip(*x))]