[Tutor] 2 problems in a small script

Terry Carroll carroll at tjc.com
Fri Oct 12 22:58:03 CEST 2007


On Fri, 12 Oct 2007, Kent Johnson wrote:

> Dick Moores wrote:
>
> > I'm just not comfortable with list comprehensions yet,
> 
> Hmm, too bad. I use list comps and generator expressions constantly.

It took me a while to get list comprehensions.  It's one of those things 
that suddenly snaps into place and you're suddenly comfortable with.

What took me the longest time is to realize that it's really a way of 
generating one list from another list.  Once I got that, I started 
naturally turning to list comprehensions whenever I found myself 
generating one list from another.




More information about the Tutor mailing list