[Python-Dev] multi-loop quiz results
Thomas Wouters
thomas@xs4all.net
Thu, 13 Jul 2000 23:07:00 +0200
On Thu, Jul 13, 2000 at 03:17:41PM -0400, Greg Wilson wrote:
> I gave 20+ grad students in computer engineering and computer science
> (plus a couple of profs) the questionnaire below. A summary of
> results is:
> * Versions (D), (F), and (H) show that semi-colon separated targets
> imply cross-product iteration, but 'and' and 'while' imply
> simultaneous iteration.
Really ? Looking at it, it looks like 'while' also implies cross-product:
> (H)
> for x in [10, 20, 30] while y in [1, 2, 3]: 2 7 0 0 1 1
> print x+y
>
> (I)
> for x in [10, 20, 30] while y in [1, 2]: 0 1 0 7 2 1
> print x+y
'and' does seem to be the 'right' thing, but mostly in the awkward
extra-grouped variant... Apparently using a builtin instead of a syntax
change is a good thing. Hopefully it will at least get people thinking,
instead of assuming.
--
Thomas Wouters <thomas@xs4all.net>
Hi! I'm a .signature virus! copy me into your .signature file to help me spread!