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

Stefan Behnel stefan_ml at behnel.de
Thu May 26 09:21:34 CEST 2011


jpe, 25.05.2011 21:37:
> This optimizes startswith / endwith optimization for str.  What's
> unclear to me is how str will be mapped to either bytes or unicode

> Should I be using the type name bytes instead of str?

Different things. Robert already pointed you to the Wiki site. Basically, 
"str" is evaluated at C compile time to become either bytes or unicode, 
depending on the CPython version it is being compiled against. The same 
applies to literals. (And believe me, there has gone some work into this 
behaviour...)


> 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).

We have both a "-3" command line option and the "language_level=3" compiler 
directive for that.

Stefan


More information about the cython-devel mailing list