[Numpy-tickets] [NumPy] #456: Inconsistent behaviour of representation of numpy scalar strings when NULLs exists
NumPy
numpy-tickets@scipy....
Thu Feb 22 09:57:58 CST 2007
#456: Inconsistent behaviour of representation of numpy scalar strings when NULLs
exists
------------------------+---------------------------------------------------
Reporter: faltet | Owner: somebody
Type: defect | Status: new
Priority: normal | Milestone:
Component: numpy.core | Version:
Severity: normal | Keywords:
------------------------+---------------------------------------------------
Hi,
I think the next behaviour is somewhat inconsistent:
{{{
>>> numpy.array("a\x00\x0b\x0c\x00")
array('a',
dtype='|S5')
}}}
i.e. the representation of scalar strings truncates when the first NULL is
encountered. This is not the default behaviour in Python, that accepts
NULLs as part of the representation:
{{{
>>> s="a\x00b\x0c\x00"
>>> s
'a\x00b\x0c\x00'
}}}
Furthermore, it seems that some conversion methods works well in this
case:
{{{
>>> numpy.array("a\x00b\x0c\x00").tostring()
'a\x00b\x0c\x00'
}}}
But others seems to be broken:
{{{
>>> numpy.array("a\x00b\x0c\x00").item()
'a'
}}}
--
Ticket URL: <http://projects.scipy.org/scipy/numpy/ticket/456>
NumPy <http://projects.scipy.org/scipy/numpy>
The fundamental package needed for scientific computing with Python.
More information about the Numpy-tickets
mailing list