Hi, I'm trying to make a Pyrex/Cython module that was originally written for Python 2.x work with Python 3.x, while at the same time keeping it compatible with older versions.
It seems like when using Python 3.x, Cython will automatically replace 'unicode' with 'str', and 'str' with 'bytes'. Also, string literals are interpreted as 'bytes' unless prefixed with 'u'. However, 'bytes' is not really useful in a context where an actual string is expected, and causes problems for example when working with strings passed from Python. (One of many issues I have run into is the fact that b"foo" != "foo"...) The only solution I've found to at least get most of my code working is basically to use unicode for almost everything, but if possible I'd like to avoid unicode strings in the 2.x version. Is there a sane way to use the native string type (i.e. 'str') in either Python version? Thanks, Dominic _______________________________________________ Cython-dev mailing list [email protected] http://codespeak.net/mailman/listinfo/cython-dev
