> For example, if I have x=[ [1,2], [3,4] ] > > What I want is a new list of list that has four sub-lists: > > [[1,2], [f(1), f(2)], [3,4], [f(3), f(4)]]
[[a, [f(b) for b in a]] for a in x] -- http://mail.python.org/mailman/listinfo/python-list
> For example, if I have x=[ [1,2], [3,4] ] > > What I want is a new list of list that has four sub-lists: > > [[1,2], [f(1), f(2)], [3,4], [f(3), f(4)]]
[[a, [f(b) for b in a]] for a in x] -- http://mail.python.org/mailman/listinfo/python-list