Hi all, Since it is an API decision, I have an open PR:
https://github.com/numpy/numpy/pull/28576 To allow `out=...` in ufuncs (yes, three dots, the Ellipsis). NumPy normally has the bad habit of always returning scalars rather than 0-D arrays. Passing `out=...` would be one way to ensure arrays are always returned. I have picked it because: 1. to me `out=np.ndarray` might indicate no subclasses or be weird if e.g. cupy supports it (via `__array_ufunc__`). 2. `...` allures to `arr1d[0, ...]` in indexing, where including `...` ensures an array return even if it does nothing else. This is useful in a few places in NumPy, the main reason is if you have `dtype=object`. IMO, this doesn't preclude a general transition towards returning scalars less aggressively (or never), but to me it is easy and useful enough to do, even if we might have a better solution in the future. If no-one has concerns, I think we'll merge this soon, but I am always happy to hear opinions! Cheers, Sebastian PS: This PR is about ufuncs, I suppose a few odd functions might "inherit" it. We may want to allow it for other functions that have an `out=`, but it is not the case yet. _______________________________________________ NumPy-Discussion mailing list -- numpy-discussion@python.org To unsubscribe send an email to numpy-discussion-le...@python.org https://mail.python.org/mailman3/lists/numpy-discussion.python.org/ Member address: arch...@mail-archive.com