[Numpy-tickets] [NumPy] #321: Semantic difference in formats and dtype parameters in rec.fromarrays
NumPy
numpy-tickets at scipy.net
Thu Oct 5 10:11:27 CDT 2006
#321: Semantic difference in formats and dtype parameters in rec.fromarrays
--------------------+-------------------------------------------------------
Reporter: faltet | Owner: somebody
Type: defect | Status: new
Priority: normal | Milestone:
Component: Other | Version:
Severity: normal | Keywords:
--------------------+-------------------------------------------------------
Maybe this happens in other contexts as well, but I noticed it first in
rec.fromarrays:
{{{
In [26]:numpy.rec.fromarrays([[[0,1],[1,2]]], formats="(2,)i4")
Out[26]:
recarray([(array([0, 1]),), (array([1, 2]),)],
dtype=[('f1', '<i4', (2,))])
# Fine, but...
In [27]:numpy.rec.fromarrays([[[0,1],[1,2]]], dtype="(2,)i4")
---------------------------------------------------------------------------
exceptions.ValueError Traceback (most
recent call last)
/home/faltet/python.nobackup/numpy/<ipython console>
/usr/lib/python2.4/site-packages/numpy/core/records.py in
fromarrays(arrayList, dtype, shape, formats, names, titles, aligned,
byteorder)
296 print "descr-->", descr, type(descr)
297
--> 298 # Determine shape from data-type.
299 if len(descr) != len(arrayList):
300 raise ValueError, "mismatch between the number of fields
"\
ValueError: mismatch between the number of fields and the number of arrays
}}}
--
Ticket URL: <http://projects.scipy.org/scipy/numpy/ticket/321>
NumPy <http://projects.scipy.org/scipy/numpy>
The fundamental package needed for scientific computing with Python.
More information about the Numpy-tickets
mailing list