[Python-Dev] Replacement for array.array('u')?

Steve Dower steve.dower at python.org
Fri Mar 22 12:09:40 EDT 2019


On 22Mar2019 0433, Antoine Pitrou wrote:
> The question is: why would you use a array.array() with a Windows C API?

I started replying to this with a whole lot of examples, and eventually 
convinced myself that you wouldn't (or shouldn't).

That said, I see value in having a type for array/struct/memoryview that 
"is the same size as wchar_t", since that will avoid people having to 
guess (the docs for array in particular are deliberately vague about the 
actual size of the various types).

This is not the same as "UCS-4" - that's a very Linux-centric point of 
view. Decoupling it from Py_UNICODE is fine though, since that type will 
have no meaning eventually. But the PyUnicode_*WideChar APIs are not 
going away, which means that wchar_t still exists and has to have a 
known size at compile time.

Cheers,
Steve


More information about the Python-Dev mailing list