[Tutor] when do I use this?
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
> Tutor maillist - Tutor at python.org
Tim Johnson <tim at johnsons-web.com>
More information about the Tutor