[Python-Dev] PEP 393: Flexible String Representation

Glenn Linderman v+python at g.nevcal.com
Thu Jan 27 22:06:18 CET 2011

On 1/27/2011 12:26 PM, James Y Knight wrote:
> On Jan 27, 2011, at 2:06 PM, Stefan Behnel wrote:
>> "Martin v. Löwis", 24.01.2011 21:17:
>>> The Py_UNICODE type is still supported but deprecated. It is always
>>> defined as a typedef for wchar_t, so the wstr representation can double
>>> as Py_UNICODE representation.
>> It's too bad this isn't initialised by default, though. Py_UNICODE is the only representation that can be used efficiently from C code and Cython relies on it for fast text processing. This proposal will therefore likely have a pretty negative performance impact on extensions written in Cython as the compiler could no longer expect this representation to be available instantaneously.
> But the whole point of the exercise is so that it doesn't have to store a 4byte-per-char representation when a 1byte-per-char rep would do. If cython wants to work most efficiently with this proposal, it should learn to deal with the three possible raw representations.

C was doing fast text processing on char long before Py_UNICODE existed, 
or wchar_t.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-dev/attachments/20110127/b966b901/attachment.html>

More information about the Python-Dev mailing list