Re: Comprehensions

Greg Ewing <[email protected]> Thu, 15 Jul 2004 13:25:06 +1200
Newsgroups gmane.comp.lang.prothon.user
Message-ID <[email protected]>
> So this means I could say:
> 
> for x in a*b+3 for a in [1,2,4] for b in z if b.prime?(): 

If you're following Python syntax, that would have to be

  for x in (a*b+3 for a in [1,2,4] for b in z if b.prime?()):

Guido decided it was too visually confusing to allow
a bare genexp without parens around it, except when it's
the sole argument of a function call.

Greg Ewing, Computer Science Dept, +--------------------------------------+
University of Canterbury,	   | A citizen of NewZealandCorp, a	  |
Christchurch, New Zealand	   | wholly-owned subsidiary of USA Inc.  |
[email protected]	   +--------------------------------------+