[FP] Rewriting name bindings as expressions

Thomas Wouters thomas at xs4all.net
Fri May 25 11:37:09 CEST 2001

On Fri, May 25, 2001 at 12:03:44AM -0500, Ben Wolfson wrote:

> ans = [y(x)+1 for y in (lambda a: a*a,) for x in range(10)]

Maybe I'm missing the point of this thread, but you can write that as:

ans = [(lambda a: a*a)(x)+1 for x in range(10)]

Short-ly y'rs, ;)

Thomas Wouters <thomas at xs4all.net>

Hi! I'm a .signature virus! copy me into your .signature file to help me spread!

More information about the Python-list mailing list