for loop possible enhancement

bob van der Poel bvdpoel at uniserve.com
Fri Sep 22 13:44:48 EDT 2000


Playing with some for/next loops I find that having something like

	for a,b in [[1,2],[3,4],[4,5]]:
		...

works nicely. However, what would be more useful at times is the
possiblity to:

	for a,b in [[1,2,3,4], [a,b,c,d]]:

which, intutively(?) would set a to the value 1 and b to 'a', etc. What
I'm wondering is if it might be possible to add to the for syntax
something like:

	for a in [1,2,3,4], b in [a,b,c,d]:

I think I'm looking for some of the flexibility the foreach loop in tcl
gives, but then I find that particular command a tad on the confusing
side...

Anyway, just a thought.

-- 
   __
  /  )      /         Bob van der Poel
 /--<  ____/__        bvdpoel at uniserve.com
/___/_(_) /_)         http://users.uniserve.com/~bvdpoel



More information about the Python-list mailing list