The State of Python

Thomas Wouters thomas at xs4all.net
Fri Jul 28 15:25:42 EDT 2000


On Fri, Jul 28, 2000 at 08:14:57PM +0300, Vespe Savikko wrote:

>       http://www.pythonlabs.com/talks.html

> The first example on slide 14, List Comprehensions:

> [(x, x**2) for x in range(5)] 
>      -> [(0,0), (1,1), (4,4), (9,9), (16,16)]

> My intuition says the result should be:

>      -> [(0,0) ,(1,1), (2,4), (3,9), (4,16)]

> Is there a typo in the slide or have I missed some aspect of list
> comperehensions? 

Don't think it qualifies as a typo; too consistent. But yes, the result is
what you expect, not what you see. Let this be an example: don't code and
discuss licences at the same time ! :-)

-- 
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