RFC: Consider updating `copy` semantics in `astype` to `False/None/True`
Nobody has claimed this yet.
Assessment
- Difficulty
- 5/5
- Estimated time
- Over a week
- Newbie friendliness
- 25/100
- Issue type
- Feature
- Clarity
- Mostly clear
- Activity status
- Stale
- Domain
- api, documentation
Research direction
Start by reading the astype specification introduced in pull request 290 and compare its copy semantics with asarray, dlpack, from_dlpack, and reshape. Review the 13-comment discussion for an unresolved decision. Done means the RFC reaches an agreed semantic change and the relevant specification text is updated consistently.
Written by the indexing model from the issue text.
Description
Currently the specification for astype, as added in https://github.com/data-apis/array-api/pull/290, specifies that copy=False/True wherein there is no room for a "copy never" option, and the default copy=True means that calls to astype that do not specify the copy kwarg never have a chance to be a no-op -- this results in unnecessary copies as default behavior.
Other functions which use the copy=False/None/True semantics include:
asarray__dlpack__from_dlpackreshape
Hence,
- I think it is confusing that
copy=Falseimplies a copy will still occur while elsewhere it means "copy never" copy=Trueis imo a bad default that leads to more memory movement than may be necessary- The ability to specify "copy never" is helpful when one must be careful with memory behavior
- Dominant language
- Python
- Stars
- 281
- Forks
- 52
- PR merge metrics
- No merged PRs in 30d
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from data-apis/array-api
-
Difficulty 1/5 1-3 hours Newbie friendliness 88/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
-
Difficulty 5/5 Over a week Newbie friendliness 35/100
-
Maintenance
-
Difficulty 5/5 Over a week Newbie friendliness 25/100
All issues in data-apis/array-api
Similar issues
-
documentation help wanted
Difficulty 2/5 1-3 hours Newbie friendliness 90/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 90/100
simonw/sqlite-utils#872 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100