[ create a new paste ] login | about

Link: http://codepad.org/lL027H5I    [ raw code | output | fork | 1 comment ]

sah - Python, pasted on Mar 28:
1
print [(x,y) for x in [[1],[2],[3]] for y in x]


Output:
1
2
[([1], 1), ([2], 2), ([3], 3)]



Create a new paste based on this one


Comments:
posted by sah on Mar 28
python list comprehensions work a lot like haskell's
reply