[Python-Dev] list comprehensions again...

Jeremy Hylton jeremy@beopen.com
Tue, 11 Jul 2000 23:29:36 -0400 (EDT)

>>>>> "BAW" == Barry A Warsaw <bwarsaw@beopen.com> writes:

  BAW>   | print [i, s for i in nums for s in strs] 
  BAW>   | print [i, s for i in nums for s in [f for f in strs if "n" in f]]

  BAW> Yow!  No one will accuse Python of only having one way to do it
  BAW> anymore!  Even without the curse-word-symbols, I fear excessive
  BAW> scalp exposing head-scratching when I see this in code.

I think these examples demonstrate the need for some punctuation,
though perhaps not curse-word-symbols.  

I really like the vertical bar that Haskell uses to separate the
variables being assigned to from the generator expression.  It's a
very familiar notation from mathematics.  There also needs to be some
punctuation to separate each generator expression when there is more
than one.  Commas and semicolons both seem reasonable viewed in
isolation; commas are problematic because they are already used for
tuple creation.