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

Antoine Pitrou solipsis at pitrou.net
Fri Mar 22 07:33:01 EDT 2019


On Fri, 22 Mar 2019 13:27:08 +0200
Serhiy Storchaka <storchaka at gmail.com> wrote:

> 22.03.19 09:31, Greg Ewing пише:
> > A poster on comp.lang.python is asking about array.array('u').
> > He wants an efficient mutable collection of unicode characters
> > that can be initialised from a string.
> > 
> > According to the docs, the 'u' code is deprecated and will be
> > removed in 4.0, but no alternative is suggested.
> > 
> > Why is this being deprecated, instead of keeping it and making
> > it always 32 bits? It seems like useful functionality that can't
> > be easily obtained another way.  
> 
> Making it always 32 bits would be compatibility breaking change. 
> Currently array('u') represents the wchar_t string, and many API on 
> Windows require it.

The question is: why would you use a array.array() with a Windows C API?

Regards

Antoine.




More information about the Python-Dev mailing list