[Tutor] when do I use this?
Tim Johnson
tim at johnsons-web.com
Mon Mar 15 19:39:33 EST 2004
* Christopher Spears <cspears2002 at yahoo.com> [040315 15:22]:
> Several times I have iterated over a sequence with
> some code that looks like this:
I'm going to put in my two cents worth because
I've thus far taken a very simplistic approach
to iteration myself:
> for f in range(len(files)):
Suppose one had several sequences that were of the
same length. Then with the approach above, one
could use <f> to access each of them.
However, I believe that there are more 'elegant'
and 'pythonesque' ways of iterating over multiple
sequences, so I'm looking forward to more comments.
> and fellow hackers have told me I can just use:
>
> for f in seq:
I love this approach .... like to see this in
other languages!
> _______________________________________________
> Tutor maillist - Tutor at python.org
> http://mail.python.org/mailman/listinfo/tutor
--
Tim Johnson <tim at johnsons-web.com>
http://www.alaska-internet-solutions.com
More information about the Tutor
mailing list