Is it possible to have something like:
list1 = ...
currentValue = 0
list2 = [currentValue += i, i for i in list1]
I tried that but didn\'t wor
I'm not quite sure what you're trying to do but it's probably something like
list2 = [(i, i*2, i) for i in list1]
print list2
The statement in the list comprehension has to be a single statement, but you could always make it a function call:
def foo(i):
print i
print i * 2
return i
list2 = [foo(i) for i in list1]