Sep 12, 2010

One-liner: multiple assignment

Suppose, you have variables a, b and c and you want to apply fnuction func to each of them:
a = func(a)
b = func(b)
c = func(c)

In python, it easily can be done with this:
map(func, [a, b, c])

No comments:

Post a Comment