Skip to content

Some small fixes to function signatures to make them valid Python #174

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 3 commits into from
Apr 27, 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
2 changes: 1 addition & 1 deletion spec/API_specification/array_object.md
Original file line number Diff line number Diff line change
Expand Up @@ -598,7 +598,7 @@ Returns `self[key]`.

#### Parameters

- **self**: _<array;>_
- **self**: _<array>_

- array instance.

Expand Down
2 changes: 1 addition & 1 deletion spec/API_specification/creation_functions.md
Original file line number Diff line number Diff line change
Expand Up @@ -290,7 +290,7 @@ Returns evenly spaced numbers over a specified interval.
- a one-dimensional array containing evenly spaced values.

(function-meshgrid)=
### meshgrid(*arrays, /, *, indexing='xy')
### meshgrid(*arrays, indexing='xy')
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tried, that's indeed a syntax error otherwise - mildly surprised.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

>>> x = y = np.arange(2)
>>> np.meshgrid(x, y, 'ij')
[array([[[0],
        [1]],

       [[0],
        [1]]]), array([[[0],
        [0]],

       [[1],
        [1]]]), array([[['ij'],
        ['ij']],

       [['ij'],
        ['ij']]], dtype='<U2')]

:facepalm:

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The way I remember is that *args and * are both basically the same thing. They both separate keyword only arguments. The * is just a version of *args that doesn't actually allow any additional positional arguments.


Returns coordinate matrices from coordinate vectors.

Expand Down
14 changes: 7 additions & 7 deletions spec/API_specification/data_type_functions.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,14 @@ A conforming implementation of the array API standard must provide and support t
<!-- NOTE: please keep the constants in alphabetical order -->

## Objects in API
(function-broadcast-arrays)=
### broadcast_arrays(\*args, /)
(function-broadcast_arrays)=
### broadcast_arrays(*arrays)

Broadcasts one or more arrays against one another.

#### Parameters

- **\*args**: _Sequence\[ &lt;array&gt; ]_
- **arrays**: _Sequence\[ &lt;array&gt; ]_

- arrays to broadcast.

Expand All @@ -24,7 +24,7 @@ Broadcasts one or more arrays against one another.

- a list of broadcasted arrays. Each array must have the same shape. Each array must have the same dtype as its corresponding input array.

(function-broadcast-to)=
(function-broadcast_to)=
### broadcast_to(x, shape, /)

Broadcasts an array to a specified shape.
Expand All @@ -49,14 +49,14 @@ Broadcasts an array to a specified shape.

- if the array is incompatible with the specified shape (see {ref}`broadcasting`).

(function-can-cast)=
### can_cast(from, to, /)
(function-can_cast)=
### can_cast(from_, to, /)

Determines if one data type can be cast to another data type according {ref}`type-promotion` rules.

#### Parameters

- **from**: _Union\[ &lt;dtype&gt;, &lt;array&gt;]_
- **from_**: _Union\[ &lt;dtype&gt;, &lt;array&gt;]_

- input data type or array from which to cast.

Expand Down