Temporary variables in list comprehensions

Paul Rubin no.email at nospam.invalid
Mon Jan 9 05:46:44 EST 2017


Serhiy Storchaka <storchaka at gmail.com> writes:
> gen = (expensive_calculation(x) for x in data)
> result = [(tmp, tmp + 1) for tmp in gen]

result = [(tmp, tmp+1) for tmp in map(expensive_calculation, data)]



More information about the Python-list mailing list