On 31/03/2015 21:49, boB Stepp wrote:
On Tue, Mar 31, 2015 at 3:42 PM, Zachary Ware
<zachary.ware+py...@gmail.com> wrote:

Also, not that since you aren't using the index for anything, you
don't need to use enumerate() to iterate over the list.  Just do "for
item in L:".  Of course, if you actually use the index in the real
code that I assume this was cut out of, keep enumerate; it's the right
tool for the job.

Yeah, I simplified my actual code into the smallest snippet that I
could reproduce my problem in. My actual code need the index.


Using an index is perhaps the traditional way of doing things but there are other options. As an example you might like to see the pairwise function here http://pythonhosted.org//more-itertools/api.html with the code available on pypi if you'd like to play.

--
My fellow Pythonistas, ask not what our language can do for you, ask
what you can do for our language.

Mark Lawrence

_______________________________________________
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor

Reply via email to