indexed() generator

Alex Martelli aleax at
Sat Jan 26 15:33:52 EST 2002

Magnus Lie Hetland wrote:
>>def indexed(seq):
>>    seq = iter(seq)
> Why do you need this step? (Just curious)

You don't -- it's redundant with the following:

>>    i = 0
>>    for item in seq:

[and no other use of seq].  Guess I just coded it
out of habit, or something...


More information about the Python-list mailing list