[docs] Query re array 'u' type code
list at qtrac.plus.com
Mon Oct 8 16:41:44 CEST 2012
On Mon, 8 Oct 2012 16:26:20 +0300
Andrew Svetlov <andrew.svetlov at gmail.com> wrote:
> You shouldn't store characters in array because char is not 'physical
> matter' but some abstract one without specified byte representation.
> You should to store string encoded by some codec instead — it makes
> things easier and well-defined.
Yes, you're right. So, in the case of chars I guess one would store,
say, s.encode("utf-32") into a 4 byte unsigned type.
Of course, it is a pity that the array module doesn't actually support
specifically sized types (like NumPy does).
> On Mon, Oct 8, 2012 at 4:13 PM, Mark Summerfield <list at qtrac.plus.com>
> > Hi,
> > According to
> > http://docs.python.org/py3k/library/array.html#module-array
> > The 'u' type code is deprecated and will be dropped in Python 4.
> > However, no information is provided on what one should use instead when
> > one wants to store an array of individual characters. I think that such
> > information would be helpful.
Mark Summerfield, Qtrac Ltd, www.qtrac.eu
C++, Python, Qt, PyQt - training and consultancy
"Advanced Qt Programming" - ISBN 0321635906
More information about the docs