List comprehension confusion...
Max M
maxm at mxm.dk
Mon Feb 3 06:29:41 EST 2003
Afanasiy wrote:
> I am confused about the purpose of list comprehensions.
> What can they do which an explicit for loop cannot?
In my feeble mind list comprehensions are the pythonic one liner way of
writing select statments:
"select * from aList where size = 42"
[obj for obj in aList if size = 42]
Anyhoo that is how I go my mind around them the first time.
--
hilsen/regards Max M Rasmussen, Denmark
http://www.futureport.dk/
Fremtiden, videnskab, skeptiscisme og transhumanisme
More information about the Python-list
mailing list