Robert Bradshaw wrote: > .. > case. But it does mean that stuff like > > --- a.pyx --- > > def foo(x): > if x > 0: > return "good" > else: > return "bad" > ------------- > > import a > print "3 is %s" % a.foo(3) > > won't work in both Py2 and Py3, which I think it should. "Principle > of least surprise."
If you import unicode_literals in that pyx (or, presumably, include an equivalent command line parameter to Cython), it will generate unicode strings. The latter example will then work in Py3 (%s is unicode), and in Py2 (%s auto-converts from unicode). -- Dag Sverre _______________________________________________ Cython-dev mailing list [email protected] http://codespeak.net/mailman/listinfo/cython-dev
