for loop possible enhancement

Fredrik Lundh effbot at telia.com
Fri Sep 22 14:00:48 EDT 2000


bob wrote:
> 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.

    http://python.sourceforge.net/peps/pep-0201.html

    "Standard for-loops in Python iterate over every element in a
    sequence until the sequence is exhausted.  However, for-loops
    iterate over only a single sequence, and it is often desirable to
    loop over more than one sequence in a lock-step fashion"

</F>



More information about the Python-list mailing list