indexed() generator

Alex Martelli aleax at aleax.it
Sat Jan 26 21:33:52 CET 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...


Alex




More information about the Python-list mailing list