FAQ
Is list comprehension on its way into the language? Or is that just a
rumour, based on Greg's patch?

And - as allways, I can't leave the syntax alone without a suggestion
of my own... Greg's patch works like this (among other things):

[(i, s) for i in nums for s in strs]

To me, this sounds a bit like

[(i, s) for i in [nums for s in strs]]

which I guess doesn't give much meaning. I think the syntax would be
clearer (and more natural language-like) with an "and" instead of the
"for"s, after the first one. The first ones marks that this is the
list of (i, s) for all of the "i"s and all of the "s"s given. Thus:

[(i, s) for i in nums and s in strs]

--

Magnus Echelon jamming noise:
Lie FBI CIA NSA Handgun Assault Bomb Drug Terrorism
Hetland Special Forces Delta Force AK47 Hillary Clinton

Search Discussions

Discussion Posts

Follow ups

Related Discussions

Discussion Navigation
viewthread | post
posts ‹ prev | 1 of 4 | next ›
Discussion Overview
grouppython-list @
categoriespython
postedDec 13, '99 at 12:39a
activeDec 13, '99 at 10:29p
posts4
users3
websitepython.org

People

Translate

site design / logo © 2022 Grokbase