-
-
Notifications
You must be signed in to change notification settings - Fork 10.8k
BUG: New ragged array message has false positives #14138
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
Comments
@mattip ping, can you take a look at this issue? If it means we need to revert that other PR, than so be it. |
Yeah, we should revert or fix We should add somewhere a test that the following succeeds (it is the corner case from #14138 since
|
@mattip I am good with reverting. Unfortunately this is in 1.17, so we should get it fixed for the 1.17.1 release probably |
This is probably a pointless comment, coming so late, but it seems the example given should result in an error.
but this is not
??? Was the argument for reversion purely for backward compatibility (i.e. it is not what we want, but the existing behavior has been entrenched for too long to change)? |
Yes, the PR inadvertently caused existing code to error without any deprecation or other kind of notice. We could change the behaviour, but should do it in a controlled way. |
I agree with @WarrenWeckesser that the behavior should be changed, but also with @mattip that it must go through a deprecation cycle. |
@mattip, OK, thanks, that makes sense. |
We would have to decide which way we should go: whether to disallow |
@WarrenWeckesser there is another dimension to this, because |
Of course, and I 100% agree with him :). Although we do have some "reverse broadcasting" rules, similar to this, which work probably only because of this behaviour... OTOH, we did pull it off for bools and |
Indeed, I'm very much in favor of disallowing it .
np.array([1, np.array([2]), dtype=int)
np.array([np.array([1]), np.array([2]), dtype=int)
np.array([1, np.array([[[[[[2]]]]]]), dtype=int)
np.array([1, np.array([np.array([2])]), dtype=int) etc.? Also, note that this conversion is implicit, yikes.
|
It should all be errors, but I proposed changing |
A related effect of this change is that assigning a ragged list (but still of correct number of values) to a slice no longer works, as shown in this example, extracted from Matplotlib's tests:
fails with a
ValueError
because the first element is a scalar and the second element is an array of length one.I wrote a fix for this, but a question did come up for whether this was an intended change?
Originally posted by @QuLogic in #13913 (comment)
The text was updated successfully, but these errors were encountered: