Skip to content

Note that in-place operators should not change the dtype of the array #166

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

Merged
merged 1 commit into from
Apr 20, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions spec/API_specification/array_object.md
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,9 @@ an array object supporting the following in-place Python operators:
- `<<=`. May be implemented via `__ilshift__`.
- `>>=`. May be implemented via `__irshift__`.

An in-place operation must not change the dtype or shape of the in-place array
as a result of {ref}`type-promotion` or {ref}`broadcasting`.

```{note}

In-place operators must be supported as discussed in {ref}`copyview-mutability`.
Expand Down
6 changes: 3 additions & 3 deletions spec/API_specification/type_promotion.md
Original file line number Diff line number Diff line change
Expand Up @@ -102,9 +102,9 @@ arrays must be supported for:
- `array <op> scalar`
- `scalar <op> array`

where `<op>` is a built-in operator (see {ref}`operators` for operators
supported by the array object) and `scalar` has a compatible type and value
to the array dtype:
where `<op>` is a built-in operator, including in-place operators (see
{ref}`operators` for operators supported by the array object) and `scalar` has
a compatible type and value to the array dtype:
- Python `bool` for a `bool` array dtype,
- a Python `int` within the [bounds](data-types) of the given dtype for integer array dtypes,
- a Python `int` or `float` for floating-point array dtypes
Expand Down