[Cython] prevent comprehension variables from leaking

Stefan Behnel stefan_ml at behnel.de
Fri Dec 19 16:13:24 CET 2008


Dag Sverre Seljebotn wrote:
> a) For builtins like range, we can always infer the variable as an int, 
> similar to the ForIn-optimization.

Do you mean "For-From" optimisation?

I actually think the fact that the for-from loop makes its run variable a C
long even if not explicitly typed is worth a general optimisation that
should also apply to for-in-range loops. Maybe restricting this to the case
where we find a compile-time known value range that fits into 31 bits would
catch most use cases and always be portable, regardless of sizeof(long).

Stefan


More information about the Cython-dev mailing list