[Python-Dev] PEP-393/PEP-3118: unicode format specifiers (original) (raw)

Stefan Krah stefan at bytereef.org
Tue Mar 6 17:04:47 CET 2012


Hello,

In the array module the 'u' specifier previously meant "2-bytes, on wide builds 4-bytes". Currently in 3.3 the 'u' specifier is mapped to UCS4.

I think it would be nice for Python3.3 to implement the PEP-3118 suggestion:

'c' -> UCS1

'u' -> UCS2

'w' -> UCS4

Actually we could even add 'a' -> ASCII, then a unicode object could be a buffer provider that gives the correct view according to the maxchar in the buffer. This opens the possibility for strongly typed memoryviews of strings. Not sure if this is useful, just an idea.

Stefan Krah



More information about the Python-Dev mailing list