On 29/03/2015 02:25, Jim Mooney wrote:
Shouldn't this give me a list of squares?
[lambda x: x**2 for x in range(10)]

Instead I'm getting ten of these (with different addresses)
<function <listcomp>.<lambda> at 0x01262A50>]


That's exactly what you've asked the code to do. What makes you think you need a lambda function?

[x**2 for x in range(10)]

should do the trick.

--
My fellow Pythonistas, ask not what our language can do for you, ask
what you can do for our language.

Mark Lawrence

_______________________________________________
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor

Reply via email to