Pierre GM schrieb: >> I was also a bit surprised at the following behavior: >>>> a = numpy.asarray([1,1]) >>>> a > array([1, 1]) >>>> a[0]=numpy.nan >>>> a > array([0, 1]) > > Seems to affect only the int_ arrays: > >>>> a = numpy.asarray([1,1], dtype=float_) >>>> a > array([1., 1.]) >>>> a[0]=numpy.nan >>>> a > array([ nan, 1. ]) >
Sure it works with floats. The question is, should there maybe be an error if the type of the assigned value doesn't match the dtype of the array, instead of silently doing something unexpected? Consider the following (with still the same *integer* array a from my post above): >>> a[0]=0.1 >>> a array([0, 1]) >>> a[0]='0' Traceback (most recent call last): File "<interactive input>", line 1, in ? TypeError: an integer is required This TypeError makes a lot of sense, but why does it only react to strings, not to floats? Cheers, Sven Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642 _______________________________________________ Numpy-discussion mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/numpy-discussion
