[Cython] [cython] Initial startswith / endswith optimization (#35)

Robert Bradshaw robertwb at math.washington.edu
Wed May 25 21:51:10 CEST 2011

On Wed, May 25, 2011 at 12:37 PM, jpe
<reply+i-954759-90be1c778e144f2c17b3665667d3d62b01062479 at reply.github.com>
> This optimizes startswith / endwith optimization for str.


>What's unclear to me is how str will be mapped to either bytes or unicode; I assume at some point cython will have a python3 syntax mode where str is unicode, print is a function, etc (if it doesn't have one already).  Should I be using the type name bytes instead of str?

I'm glad you're thinking about this question, some explanation of the
various string types is at

Probably the way to do this is have one optimization for bytes, one
for unicode, and then have a third type for str that dispatches to the
one or the other depending on the python version (using #define).

- Robert

More information about the cython-devel mailing list