for loop possible enhancement

Christopher Browne cbbrowne at news.hex.net
Sat Sep 23 06:46:15 CEST 2000


In our last episode (Fri, 22 Sep 2000 18:00:48 GMT),
the artist formerly known as Fredrik Lundh said:
>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>

Ah.  You're looking for the Common Lisp "LOOP" facility.  It can have
an arbitrary set of simultaneous sequences that are "lock-stepped."
-- 
(concatenate 'string "aa454" "@" "freenet.carleton.ca")
<http://www.ntlug.org/~cbbrowne/lisp.html>
Your latest program has been judged UNTASTEFUL by the T daemon;
and automatically deleted.



More information about the Python-list mailing list