Re:Python iteration
by samdk on Wednesday April 25, 2012 @12:56PM
(#3889900)
I use it rarely in Python, although it's sometimes useful. I use it more often in other languages to replicate Python's enumerate, since zip(range(len(seq)),seq) is basically enumerate(seq) (although with this implementation it's not a generator).
[ Parent
| on HN ]
Re:Python iteration
by koenigdavidmj on Wednesday April 25, 2012 @01:03PM
(#3889937)
Ah, but this is:
from itertools import izip
izip(xrange(len(seq)), seq)