[Python-Dev] Lockstep iteration - eureka!

Greg Ewing greg@cosc.canterbury.ac.nz
Thu, 10 Aug 2000 14:19:32 +1200 (NZST)


Just van Rossum <just@letterror.com>:

>        for <index> indexing <element> in <seq>:

Then idea is good, but I don't like this particular syntax much. It
seems to be trying to do too much at once, giving you both an index
and an element.  Also, the wording reminds me unpleasantly of COBOL
for some reason.

Some time ago I suggested

   for <index> over <sequence>:

as a way of getting hold of the index, and as a direct
replacement for 'for i in range(len(blarg))' constructs.
It could also be used for lockstep iteration applications,
e.g.

   for i over a:
      frobulate(a[i], b[i])

Greg Ewing, Computer Science Dept, +--------------------------------------+
University of Canterbury,	   | A citizen of NewZealandCorp, a	  |
Christchurch, New Zealand	   | wholly-owned subsidiary of USA Inc.  |
greg@cosc.canterbury.ac.nz	   +--------------------------------------+