10000 Order-dependence setting nested arrays of different shapes · Issue #9684 · numpy/numpy · GitHub
[go: up one dir, main page]

Skip to content

Order-dependence setting nested arrays of different shapes #9684

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
comatrion opened this issue Sep 13, 2017 · 4 comments
Closed

Order-dependence setting nested arrays of different shapes #9684

comatrion opened this issue Sep 13, 2017 · 4 comments

Comments

@comatrion
Copy link
comatrion commented Sep 13, 2017

For example:

>>> a = np.array([np.array([1, 2]), np.array(1)])
>>> a
array([array([1, 2]), array(1)], dtype=object)

>>> b = np.array([np.array(1), np.array([1, 2])])
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ValueError: setting an array element with a sequence.

Specifying dtype avoids the exception for b:

>>> b = np.array([np.array(1), np.array([1, 2])], dtype=object)
>>> b
array([array(1), array([1, 2])], dtype=object)

However dtype is optional. If an array can be instantiated successfully without dtype for a given input sequence, then re-ordering the sequence should not cause an exception.

python 3.4.5 numpy 1.13.1.

@jsclose
Copy link
Contributor
jsclose commented Apr 2, 2018

Is this an actual issue? Should numpy automatically re order the array?

@eric-wieser
Copy link
Member

We're definitely aware of this, and there's an issue somewhere suggesting that we change this behavior so that passing dtype=object is always required, and that otherwise both cases should error.

@jsclose
Copy link
Contributor
jsclose commented Apr 2, 2018

#5353 it seems like issue and this experiment #10147. Was there any resolution to that?

@eric-wieser
Copy link
Member

Fixed in #11601

@eric-wieser eric-wieser added this to the 1.16.0 release milestone Jul 23, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants
0