Do this as a list comprehension?

John Salerno johnjsal at gmailNOSPAM.com
Sat Jun 7 14:16:19 EDT 2008


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. Isn't 
the point of enumerate to get the index of a specific item, as well as 
that item itself? It seems like arbitrarily altering the index (i+8) is 
an abuse of enumerate's true purpose.

Does this make any sense, or is it generally acceptable to use enumerate 
like this?



More information about the Python-list mailing list