l = [1,"bob",[[4,3],[2,1]], ["a","b","c"], np.asarray([1,2,3])] flatten = lambda *n: (e for a in n for e in (flatten(*a) if isinstance(a, (tuple, list)) else (a,))) list(flatten(l)) >>> [1, 'bob', 4, 3, 2, 1, 'a', 'b', 'c', array([1, 2, 3])]