[NumPy-Tickets] [NumPy] #1552: "fixed-length" strings automatically truncate right-side \x00 bytes
NumPy Trac
numpy-tickets@scipy....
Fri Jul 23 14:49:45 CDT 2010
#1552: "fixed-length" strings automatically truncate right-side \x00 bytes
------------------------+---------------------------------------------------
Reporter: chrismurf | Owner: somebody
Type: defect | Status: new
Priority: normal | Milestone: Unscheduled
Component: numpy.core | Version: 1.3.0
Keywords: |
------------------------+---------------------------------------------------
Trivial Example:
{{{
#!rst
.. code-block:: python
map(ord, N.array(["\x00"])[0]) returns []
map(ord, N.array(["\x01"])[0]) returns [1]
}}}
This seems highly inconsistent.
All other strings in python store size seperately, rather than truncating
following null bytes. I can see where for text strings this may be
desirably behavior, but for binary strings (my use case) it is far from
it. As is, I need to wrap every returned value with a call to 'ljust(x,
"\x00")' or equivalent.
It would be nice to have an ''actual'' fixed-length string dtype, or have
a way to disable this behavior.
--
Ticket URL: <http://projects.scipy.org/numpy/ticket/1552>
NumPy <http://projects.scipy.org/numpy>
My example project
More information about the NumPy-Tickets
mailing list