>> for idx, value in enumerate(a):
>> BLOCK
>>
>> could be turned into the much more efficient
>>
>> for idx from 0 <= len(a):
>> value = a[idx]
>> BLOCK
>>
>
> Provided that a is indexable, which is getting less likely in recent
> Python code.
>
Ahh. True. In fact, even when it is indexable, it would still be
changing behaviour.
Still, the following gives about a small speedup (10-30% depending on
the idx type and conversions required) in some simple benchmarks:
cdef int idx
for idx, value in enumerate(a):
BLOCK
versus
cdef int idx = 0
for value in a:
BLOCK
idx += 1
Just thought I'd mention it (I realize it is kind of irrelevant and not
really a priority).
Dag Sverre
_______________________________________________
Cython-dev mailing list
[email protected]
http://codespeak.net/mailman/listinfo/cython-dev