Mix lambda and list comprehension?

Peter Barth peter.barth at t-online.de
Tue Jul 15 03:02:32 EDT 2003


Hi,
trying to mix lambda expresions and list comprehension 
doesn't seem to work.
---
>>> [lambda x:x+y for y in range(10)][9](2)
11
>>> [lambda x:x+y for y in range(10)][4](2)
11
---
I expected the second expression to return 6.
What did I do wrong? Any hints?
Thanks
- Peter




More information about the Python-list mailing list