On Mon, Jul 5, 2021, at 00:42, Ralf Gommers wrote:
I share your dislike, but I don't really see a better place where it doesn't make it even harder to spell, but I did just think of an alternative that may actually be quite reasonable: keep it private.
That would be fine. We haven't had this feature requested for many years, so as long as it is available in some shape or form it should satisfy the advanced users who need it. It also doesn't force us into a decision we cannot reverse (adding to the top-level API).
The reason why Gagandeep started working on this is so we can have the never-copy behavior in the `numpy.array_api` namespace. For the `asarray` function there, the `copy` keyword is still boolean, with description:
Whether or not to make a copy of the input. If
True, always copies.
False, never copies for input which supports DLPack or the buffer protocol,
in case that would be necessary.
None , reuses existing memory buffer if possible, copies otherwise.
In the end I think that's better than strings, and way better than enums - we just can't have that in the main namespace, because we can't change what `False` does.
W.r.t. NumPy's API: it could be okay to change the behavior of copy=False to make it more strict (no copies ever), because then at least errors will be raised and we can provide a message with instructions on how to fix it.