Skip to content
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

docs: clarify copy kwarg behavior in asarray for libraries disallowing mutation #886

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

kgryte
Copy link
Contributor

@kgryte kgryte commented Jan 23, 2025

This PR:

  • addresses discussion in RFC: add copy #495 by clarifying that, for libraries disallowing mutation, when provided known array input, copy=True can be ignored.
  • moves notes to a dedicated notes section, rather than interleaved between API descriptions.

The principle ask from #495 was to have an explicit API to guarantee an output array which can be safely mutated. asarray(x, copy=True) satisfies that ask; however, for libraries such as JAX, performing an explicit copy is unnecessary, as mutation is disallowed by design. This PR provides an escape hatch for such libraries by allowing them to disregard copy=True when provided known array input.

@kgryte kgryte added the API change Changes to existing functions or objects in the API. label Jan 23, 2025
@kgryte kgryte added this to the v2024 milestone Jan 23, 2025
@kgryte kgryte mentioned this pull request Jan 23, 2025
@kgryte
Copy link
Contributor Author

kgryte commented Jan 23, 2025

Moving to draft, as the language in this PR is related and likely dependent on the outcome of other discussions:

@kgryte kgryte marked this pull request as draft January 23, 2025 03:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
API change Changes to existing functions or objects in the API.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant