[Cython] About IndexNode and unicode[index]

Stefan Behnel stefan_ml at behnel.de
Fri Mar 1 09:00:02 CET 2013

Zaur Shibzukhov, 01.03.2013 07:54:
>>>> I think you could even pass in two flags, one for wraparound and one for
>>>> boundscheck, and then just evaluate them appropriately in the existing "if"
>>>> tests above. That should allow both features to be supported independently
>>>> in a fast way.
>>> Intresting, could C compilers in optimization mode to eliminate unused
>>> evaluation path in nested if statements with constant conditional
>>> expressions?
>> They'd be worthless if they didn't do that. (Even Cython does it, BTW.)
> Then it can simplify writing utility code in order to support
> different optimization flags in other cases too.

Usually, yes. Look at the dict iteration code, for example, which makes
pretty heavy use of it.

This may not work in all cases, because the C compiler can decide to *not*
inline a function, for example, or may not be capable of cutting down the
code sufficiently in some specific cases.

I agree in general, but I wouldn't say that it's worth changing existing
(and working) code.


More information about the cython-devel mailing list