To be honest, this doesn't seem justifiable.
Where it got me is interfacing with c-code that expected a 1d array, and I was calling it with arrays of varying length. I was using this to ensure the proper typing; however, when the array was length 1, the program crashed...
Should I file a bug report?
On Mon, Apr 28, 2008 at 11:51 PM, Charles R Harris firstname.lastname@example.org wrote:
On Tue, Apr 29, 2008 at 12:28 AM, Hoyt Koepke email@example.com wrote:
I have a quick question that I'm hoping will improve my numpy understanding. I noticed some behavior when using float64 to convert a matrix type that I didn't expect:
In : b1 = array([1.0])
In : float64(b1) Out: 1.0
In : b2 = array([1.0, 2.0])
In : float64(b2) Out: array([ 1., 2.])
I didn't expect calling float64 would convert b1 to a scalar. Seems like an inconsistency. I assume this is intentional, as someone would have noticed it a long time ago if not, so could someone explain the reasoning behind it? (or point me to a source that will help?)
It's inconsistent and looks like a bug:
In : float32(array([[]])) Out: array([[[ 1.]]], dtype=float32)
In : float64(array([[]])) Out: 1.0
Float64 is a bit special because it starts as the python float. Maybe Travis can say what the differences are.
Numpy-discussion mailing list Numpyfirstname.lastname@example.org http://projects.scipy.org/mailman/listinfo/numpy-discussion