Hi,
Robert Bradshaw wrote:
> I'm surprised that str is
> mapped to bytes in Python 3. What was the justification for this, or
> is it just a bug? I think if
>
> def foo():
> return str, isinstance("abc", str)
>
> have different behavior in Cython and Python that there's a bug
Define Python: Py2 or Py3?
Python 2 is still the defining context for Cython, so "str" is a byte
string and "unicode" is a Unicode string. If you do the above in Py2, it
will return True for a byte string and False for a unicode string. If you
do it in Cython, you will get the same result. And that's still true when
you compile your code for Py3. The same applies for the Cython code
isinstance(u"abc", unicode)
which will return True in both environments. Given that "abc" is a byte
string in Cython, I'd be rather surprised to have
isinstance("abc", str)
return True in Py2 and False in Py3, and
isinstance("abc", unicode)
return False in Py2 and True in Py3.
Stefan
_______________________________________________
Cython-dev mailing list
[email protected]
http://codespeak.net/mailman/listinfo/cython-dev