[Numpy-discussion] Bug or feature?
Konrad Hinsen
konrad.hinsen@fastmail....
Mon Aug 22 02:36:15 CDT 2011
Hi everyone,
I just stumbled on a behavior in NumPy for which I can't find an
explanation in the documentation. I wonder whether this is a bug or an
undocumented (or badly documented) feature:
--------------------------------------------------------------------------------------
import numpy
t = numpy.dtype([("rotation", numpy.float64, (3, 3)),
("translation", numpy.float64, (3,))])
# works
a1 = numpy.array([], dtype=t)
# doesn't work
a2 = numpy.array((), dtype=t)
# -> ValueError: size of tuple must match number of fields.
--------------------------------------------------------------------------------------
According to my understanding of how numpy.array should work, it
shouldn't make a difference if the first argument is a list or a
tuple, but in this case there is a difference.
Konrad.
More information about the NumPy-Discussion
mailing list