[Numpy-tickets] [NumPy] #342: Inconsistent behavior of string array constructors
NumPy
numpy-tickets at scipy.net
Fri Oct 13 00:48:55 CDT 2006
#342: Inconsistent behavior of string array constructors
---------------------+------------------------------------------------------
Reporter: gkoczyk | Owner: somebody
Type: defect | Status: new
Priority: normal | Milestone:
Component: Other | Version: devel
Severity: normal | Keywords:
---------------------+------------------------------------------------------
If a single string is given as one of the columns of an n x m array, it
seems to be silently used to construct the remainder of entries along the
same dimension.
{{{
>>> numpy.array([ ['X'], ['X', 'X', 'X'] ], '|S1')
array([['X', 'X', 'X'],
['X', 'X', 'X']],
dtype='|S1')
}}}
If more strings are supplied, but still not enough to match dimension
length, ValueError is raised correctly.
{{{
>>> numpy.array([ ['X', 'X'], ['X', 'X', 'X'] ], '|S1')
Traceback (most recent call last):
File "<stdin>", line 1, in ?
ValueError: setting an array element with a sequence
}}}
--
Ticket URL: <http://projects.scipy.org/scipy/numpy/ticket/342>
NumPy <http://projects.scipy.org/scipy/numpy>
The fundamental package needed for scientific computing with Python.
More information about the Numpy-tickets
mailing list