[SciPy-Dev] why this not report an error for a.dtype=float when a is mixed struc array
Vincent Davis
vincent at vincentdavis.net
Fri Jun 4 20:49:27 EDT 2010
Is there a reason not to have this return an error.
>>> a1 = np.array([(1,3.3),(2,4.4)], dtype=[('a', int),('b', float)])
>>> a1
array([(1, 3.2999999999999998), (2, 4.4000000000000004)],
dtype=[('a', '<i8'), ('b', '<f8')])
>>> a1.dtype=float
>>> a1
array([ 4.94065646e-324, 3.30000000e+000, 9.88131292e-324,
4.40000000e+000])
It seems that this could really cause problems if you did not notice
what was going on.
Vincent
More information about the SciPy-Dev
mailing list