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
asarray array disagrees with isscalar about what is a scalar (at least for sets) #14396
Comments
Yes, that issue (and I am pretty sure one more), is basically a duplicate. |
Perhaps we should try to deprecate |
That's going to be very noisy, there's a large amount of usage in SciPy, and I checked Dask, scikit-image and scikit-image, that turned up 5-20 usages per package. So if we really want to deprecate |
Does isscalar need to be deprecated? I'd say if anything should change it might be that What do others think should happen if I ask for |
The careful consensus right now is probably that EDIT: To be clear in the error scenario |
+1 I would have preferred an exception also (when passing a set).
…On Fri, Aug 30, 2019 at 9:03 AM Sebastian Berg ***@***.***> wrote:
The careful consensus right now is probably that np.asarray(set) should
just raise an error, because returning np.asarray(list(set)) may be a bit
strange, but returning a 0D array is just weird/unexpected. To be honest,
my gut feeling is that it might be the best way to deprecate it. Sure, make
it a super long deprecation. However, we may need a good replacement before
we do so, and I am not sure np.ndim(x) == 0 is one.
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#14396?email_source=notifications&email_token=AB3QJLALQJTFWXGCCBGLBP3QHFAEZA5CNFSM4ISDCCO2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD5SCLAA#issuecomment-526656896>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AB3QJLCI2I4G3ZNEACOVWDLQHFAEZANCNFSM4ISDCCOQ>
.
|
np.asarray believes sets are scalar:
np.isscalar does not:
I'd argues that asarray should always returns an scalar if a scalar is passed, and a non-scalar if a non-scalar is passed. (to be consistent with its treatment when a plain number is passed in).
Related to #8538 ?
The text was updated successfully, but these errors were encountered: