On Sat, Mar 28, 2015 at 6:25 PM, 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)
> . at 0x01262A50>]
Mark Lawrence's answer shows how to correct this.
Let's look at the problem a
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)
. at 0x01262A50>]
That's exactly what you've asked the code to do. What makes you think
you need a lambda function
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)
. at 0x01262A50>]
--
Jim
I can't think of a clever tagline today, so just imagine I said something
clever.
___
Tu