[Python-Dev] List comprehensions
Skip Montanaro
skip@mojam.com (Skip Montanaro)
Thu, 13 Jul 2000 09:08:52 -0500 (CDT)
>>>>> "Paul" == Paul Prescod <paul@prescod.net> writes:
Paul> I want to summarize my feelings on the list-comp syntax
Paul> issue. There is no syntax for list comprehensions that will
Paul> inherently scream "cartesian product, not parallel". The only way
Paul> to do it is by analogy to what they already know: Python.
Paul> [for x: if y(x): for z: (x,y,z)]
Agreed, however, your use of colons connotes the following to me
l = []
for x in something:
if y(x):
for z in something_else:
l.append((x,y,z))
return l
Skip