[Numpy-discussion] Possible bug in np.array type calculation
Joseph Fox-Rabinovitz
jfoxrabinovitz at gmail.com
Tue Apr 3 17:45:21 EDT 2018
I recently asked a question on Stack Overflow about whether `np.array`
could raise an error if not passed a dtype parameter:
https://stackoverflow.com/q/49639414/2988730.
Turns out it can:
np.array([1, [2]])
raises `ValueError: setting an array element with a sequence.` Surprisingly
though, the following does not, and gives the expected array with
`dtype=object`:
np.array([[1], 2])
Is this behavior a bug of sorts, or is there some arcane reason behind it?
Regards,
- Joe
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/numpy-discussion/attachments/20180403/eaf9fd66/attachment.html>
More information about the NumPy-Discussion
mailing list