[Python-Dev] Lockstep iteration - eureka!

Ken Manheimer klm@digicool.com
Wed, 9 Aug 2000 18:05:57 -0400 (EDT)


On Wed, 9 Aug 2000, Just van Rossum wrote:

> PEP:            1716099-3
> Title:          Index-enhanced sequence iteration
> [...]
>     It adds an optional clause to the 'for' statement:
> 
>         for <index> indexing <element> in <seq>:
>             ...
> [...]
> Disadvantages:
> 
>     It will break that one person's code that uses "indexing"
>     as a variable name.

      It creates a new 'for' variant, increasing challenge for beginners 
      (and the befuddled, like me) of tracking the correct syntax.

I could see that disadvantage being justified by a more significant change
- lockstep iteration would qualify, for me (though it's circumventing this
drawback with zip()).  List comprehensions have that weight, and analogize
elegantly against the existing slice syntax.  I don't think the 'indexing'
benefits are of that order, not enough so to double the number of 'for'
forms, even if there are some performance gains over the (syntactically
equivalent) zip(), so, sorry, but i'm -1.

Ken
klm@digicool.com