enumerate improvement proposal

James Stroud jstroud at mbi.ucla.edu
Sun Oct 29 07:33:24 EST 2006


Fredrik Lundh wrote:
> James Stroud wrote:
> 
>> def enumerate(itrbl, start=0, step=1):
>>    i = start
>>    for it in itrbl:
>>      yield (i, it)
>>      i += step
> 
> that's spelled
> 
>     izip(count(start), sequence)
> 
> in today's Python.
> 
>  > def in_interval(test, bounds, first=1, reverse=False):
> 
> why is it this function's job to add an offset to the actual sequence 
> index?
> 
> </F>
> 

BTW, thank you for your tip.

James



More information about the Python-list mailing list