Do this as a list comprehension?
tjreedy at udel.edu
Sun Jun 8 01:43:37 CEST 2008
"John Salerno" <johnjsal at gmailNOSPAM.com> wrote in message
news:484ad07b$0$25721$607ed4bc at cv.net...
| Mensanator wrote:
| > Surely enumerate() wasn't added to Python with no intention of
| > ever being used.
| I see your reasons for preferring enumerate over zip, but I'm wondering
| if using enumerate this way isn't a little hackish or artificial.
It seems to be a difference of personal preference. I see no reason to
write a for loop (statement or expression) when a simple usage of basic
builtins does the same. Mensanator apparently does. So it goes.
Because zip stops when the first iterator is exhausted, the original zip
with range can be pretty well future proofed with a high stop value.
Of course, a non-1 step can be added to the range.
More information about the Python-list