Skip to content

Commit 668e9e2

Browse files
committed
Make positional-parameters positional-only
Based on discussion here: #8 (comment)
1 parent 4491793 commit 668e9e2

File tree

1 file changed

+27
-26
lines changed

1 file changed

+27
-26
lines changed

spec/API_specification/functions.md

+27-26
Original file line numberDiff line numberDiff line change
@@ -36,14 +36,15 @@ a tuple of `N` non-negative integers that specify the sizes of each dimension an
3636

3737
A conforming implementation of the array API standard must provide and support the following functions adhering to the following conventions.
3838

39-
- Optional arguments must be [keyword-only](https://www.python.org/dev/peps/pep-3102/) arguments.
40-
- The `out` keyword argument must be a tuple with one entry per output.
39+
- Positional parameters must be [positional-only](https://www.python.org/dev/peps/pep-0570/) parameters. Positional-only parameters have no externally-usable name. When a function accepting positional-only parameters is called, positional arguments are mapped to these parameters based solely on their order.
40+
- Optional parameters must be [keyword-only](https://www.python.org/dev/peps/pep-3102/) arguments.
41+
- An `out` keyword argument must be a tuple with one entry per output.
4142
- If `out` is not provided or is `None` (the default), an uninitialized return array must be created for each output.
4243
- Unless stated otherwise, floating-point operations must adhere to IEEE 754-2019.
4344

4445
<!-- NOTE: please keep the functions in alphabetical order -->
4546

46-
### <a name="abs" href="#abs">#</a> abs(x, *, out=None)
47+
### <a name="abs" href="#abs">#</a> abs(x, /, *, out=None)
4748

4849
Calculates the absolute value for each element `x_i` of the input array `x` (i.e., the element-wise result has the same magnitude as the respective element in `x` but has positive sign).
4950

@@ -60,7 +61,7 @@ Calculates the absolute value for each element `x_i` of the input array `x` (i.e
6061

6162
- **out**: an array containing the absolute value of each element in `x`.
6263

63-
### <a name="acos" href="#acos">#</a> acos(x, *, out=None)
64+
### <a name="acos" href="#acos">#</a> acos(x, /, *, out=None)
6465

6566
Calculates an implementation-dependent approximation to the inverse cosine, having domain `[-1,+1]` and codomain `[+0, +π]`, for each element `x_i` of the input array `x`. Each element-wise result is expressed in radians.
6667

@@ -78,7 +79,7 @@ Calculates an implementation-dependent approximation to the inverse cosine, havi
7879

7980
- **out**: an array containing the inverse cosine of each element in `x`.
8081

81-
### <a name="acosh" href="#acosh">#</a> acosh(x, *, out=None)
82+
### <a name="acosh" href="#acosh">#</a> acosh(x, /, *, out=None)
8283

8384
Calculates an implementation-dependent approximation to the inverse hyperbolic cosine for each element `x_i` of the input array `x`.
8485

@@ -96,7 +97,7 @@ Calculates an implementation-dependent approximation to the inverse hyperbolic c
9697

9798
- **out**: an array containing the inverse hyperbolic cosine of each element in `x`.
9899

99-
### <a name="add" href="#add">#</a> add(x1, x2, *, out=None)
100+
### <a name="add" href="#add">#</a> add(x1, x2, /, *, out=None)
100101

101102
Calculates the sum for each element `x1_i` of the input array `x1` with the respective element `x2_i` of the input array `x2`.
102103

@@ -112,7 +113,7 @@ Calculates the sum for each element `x1_i` of the input array `x1` with the resp
112113

113114
- **out**: an array containing the element-wise sums.
114115

115-
### <a name="asin" href="#asin">#</a> asin(x, *, out=None)
116+
### <a name="asin" href="#asin">#</a> asin(x, /, *, out=None)
116117

117118
Calculates an implementation-dependent approximation to the inverse sine for each element `x_i` of the input array `x`. Each element-wise result is expressed in radians and ranges from `-π/2` to `+π/2`.
118119

@@ -131,7 +132,7 @@ Calculates an implementation-dependent approximation to the inverse sine for eac
131132

132133
- **out**: an array containing the inverse sine of each element in `x`.
133134

134-
### <a name="asinh" href="#asinh">#</a> asinh(x, *, out=None)
135+
### <a name="asinh" href="#asinh">#</a> asinh(x, /, *, out=None)
135136

136137
Calculates an implementation-dependent approximation to the inverse hyperbolic sine for each element `x_i` in the input array `x`.
137138

@@ -150,7 +151,7 @@ Calculates an implementation-dependent approximation to the inverse hyperbolic s
150151

151152
- **out**: an array containing the inverse hyperbolic sine of each element in `x`.
152153

153-
### <a name="atan" href="#atan">#</a> atan(x, *, out=None)
154+
### <a name="atan" href="#atan">#</a> atan(x, /, *, out=None)
154155

155156
Calculates an implementation-dependent approximation to the inverse tangent for each element `x_i` of the input array `x`. Each element-wise result is expressed in radians and ranges from `-π/2` to `+π/2`.
156157

@@ -169,7 +170,7 @@ Calculates an implementation-dependent approximation to the inverse tangent for
169170

170171
- **out**: an array containing the inverse tangent of each element in `x`.
171172

172-
### <a name="atanh" href="#atanh">#</a> atanh(x, *, out=None)
173+
### <a name="atanh" href="#atanh">#</a> atanh(x, /, *, out=None)
173174

174175
Calculates an implementation-dependent approximation to the inverse hyperbolic tangent for each element `x_i` of the input array `x`.
175176

@@ -190,7 +191,7 @@ Calculates an implementation-dependent approximation to the inverse hyperbolic t
190191

191192
- **out**: an array containing the inverse hyperbolic tangent of each element in `x`.
192193

193-
### <a name="ceil" href="#ceil">#</a> ceil(x, *, out=None)
194+
### <a name="ceil" href="#ceil">#</a> ceil(x, /, *, out=None)
194195

195196
Rounds each element `x_i` of the input array `x` to the smallest (i.e., closest to `-infinity`) integer-valued number that is not less than `x_i`.
196197

@@ -205,7 +206,7 @@ Rounds each element `x_i` of the input array `x` to the smallest (i.e., closest
205206

206207
- **out**: an array containing the rounded result for each element in `x`.
207208

208-
### <a name="cos" href="#cos">#</a> cos(x, *, out=None)
209+
### <a name="cos" href="#cos">#</a> cos(x, /, *, out=None)
209210

210211
Calculates an implementation-dependent approximation to the cosine for each element `x_i` of the input array `x`. Each element `x_i` is assumed to be expressed in radians.
211212

@@ -224,7 +225,7 @@ Calculates an implementation-dependent approximation to the cosine for each elem
224225

225226
- **out**: an array containing the cosine of each element in `x`.
226227

227-
### <a name="cosh" href="#cosh">#</a> cosh(x, *, out=None)
228+
### <a name="cosh" href="#cosh">#</a> cosh(x, /, *, out=None)
228229

229230
Calculates an implementation-dependent approximation to the hyperbolic cosine for each element `x_i` in the input array `x`.
230231

@@ -243,7 +244,7 @@ Calculates an implementation-dependent approximation to the hyperbolic cosine fo
243244

244245
- **out**: an array containing the hyperbolic cosine of each element in `x`.
245246

246-
### <a name="divide" href="#divide">#</a> divide(x1, x2, *, out=None)
247+
### <a name="divide" href="#divide">#</a> divide(x1, x2, /, *, out=None)
247248

248249
Calculates the division for each element `x1_i` of the input array `x1` with the respective element `x2_i` of the input array `x2`.
249250

@@ -259,7 +260,7 @@ Calculates the division for each element `x1_i` of the input array `x1` with the
259260

260261
- **out**: an array containing the element-wise results.
261262

262-
### <a name="exp" href="#exp">#</a> exp(x, *, out=None)
263+
### <a name="exp" href="#exp">#</a> exp(x, /, *, out=None)
263264

264265
Calculates an implementation-dependent approximation to the exponential function for each element `x_i` of the input array `x` (`e` raised to the power of `x_i`, where `e` is the base of the natural logarithm).
265266

@@ -278,7 +279,7 @@ Calculates an implementation-dependent approximation to the exponential function
278279

279280
- **out**: an array containing the evaluated exponential function result for each element in `x`.
280281

281-
### <a name="floor" href="#floor">#</a> floor(x, *, out=None)
282+
### <a name="floor" href="#floor">#</a> floor(x, /, *, out=None)
282283

283284
Rounds each element `x_i` of the input array `x` to the greatest (i.e., closest to `+infinity`) integer-valued number that is not greater than `x_i`.
284285

@@ -293,7 +294,7 @@ Rounds each element `x_i` of the input array `x` to the greatest (i.e., closest
293294

294295
- **out**: an array containing the rounded result for each element in `x`.
295296

296-
### <a name="log" href="#log">#</a> log(x, *, out=None)
297+
### <a name="log" href="#log">#</a> log(x, /, *, out=None)
297298

298299
Calculates an implementation-dependent approximation to the natural logarithm for each element `x_i` of the input array `x`.
299300

@@ -312,7 +313,7 @@ Calculates an implementation-dependent approximation to the natural logarithm fo
312313

313314
- **out**: an array containing the evaluated natural logarithm for each element in `x`.
314315

315-
### <a name="multiply" href="#multiply">#</a> multiply(x1, x2, *, out=None)
316+
### <a name="multiply" href="#multiply">#</a> multiply(x1, x2, /, *, out=None)
316317

317318
Calculates the product for each element `x1_i` of the input array `x1` with the respective element `x2_i` of the input array `x2`.
318319

@@ -328,7 +329,7 @@ Calculates the product for each element `x1_i` of the input array `x1` with the
328329

329330
- **out**: an array containing the element-wise products.
330331

331-
### <a name="round" href="#round">#</a> round(x, *, out=None)
332+
### <a name="round" href="#round">#</a> round(x, /, *, out=None)
332333

333334
Rounds each element `x_i` of the input array `x` to the nearest integer-valued number.
334335

@@ -344,7 +345,7 @@ Rounds each element `x_i` of the input array `x` to the nearest integer-valued n
344345

345346
- **out**: an array containing the rounded result for each element in `x`.
346347

347-
### <a name="sin" href="#sin">#</a> sin(x, *, out=None)
348+
### <a name="sin" href="#sin">#</a> sin(x, /, *, out=None)
348349

349350
Calculates an implementation-dependent approximation to the sine for each element `x_i` of the input array `x`. Each element `x_i` is assumed to be expressed in radians.
350351

@@ -362,7 +363,7 @@ Calculates an implementation-dependent approximation to the sine for each elemen
362363

363364
- **out**: an array containing the sine of each element in `x`.
364365

365-
### <a name="sinh" href="#sinh">#</a> sinh(x, *, out=None)
366+
### <a name="sinh" href="#sinh">#</a> sinh(x, /, *, out=None)
366367

367368
Calculates an implementation-dependent approximation to the hyperbolic sine for each element `x_i` of the input array `x`.
368369

@@ -381,7 +382,7 @@ Calculates an implementation-dependent approximation to the hyperbolic sine for
381382

382383
- **out**: an array containing the hyperbolic sine of each element in `x`.
383384

384-
### <a name="sqrt" href="#sqrt">#</a> sqrt(x, *, out=None)
385+
### <a name="sqrt" href="#sqrt">#</a> sqrt(x, /, *, out=None)
385386

386387
Calculates an implementation-dependent approximation to the square root for each element `x_i` of the input array `x`.
387388

@@ -400,7 +401,7 @@ Calculates an implementation-dependent approximation to the square root for each
400401

401402
- **out**: an array containing the square root of each element in `x`.
402403

403-
### <a name="subtract" href="#subtract">#</a> subtract(x1, x2, *, out=None)
404+
### <a name="subtract" href="#subtract">#</a> subtract(x1, x2, /, *, out=None)
404405

405406
Calculates the difference for each element `x1_i` of the input array `x1` with the respective element `x2_i` of the input array `x2`.
406407

@@ -416,7 +417,7 @@ Calculates the difference for each element `x1_i` of the input array `x1` with t
416417

417418
- **out**: an array containing the element-wise differences.
418419

419-
### <a name="tan" href="#tan">#</a> tan(x, *, out=None)
420+
### <a name="tan" href="#tan">#</a> tan(x, /, *, out=None)
420421

421422
Calculates an implementation-dependent approximation to the tangent for each element `x_i` of the input array `x`. Each element `x_i` is assumed to be expressed in radians.
422423

@@ -434,7 +435,7 @@ Calculates an implementation-dependent approximation to the tangent for each ele
434435

435436
- **out**: an array containing the tangent of each element in `x`.
436437

437-
### <a name="tanh" href="#tanh">#</a> tanh(x, *, out=None)
438+
### <a name="tanh" href="#tanh">#</a> tanh(x, /, *, out=None)
438439

439440
Calculates an implementation-dependent approximation to the hyperbolic tangent for each element `x_i` of the input array `x`.
440441

@@ -453,7 +454,7 @@ Calculates an implementation-dependent approximation to the hyperbolic tangent f
453454

454455
- **out**: an array containing the hyperbolic tangent of each element in `x`.
455456

456-
### <a name="trunc" href="#trunc">#</a> trunc(x, *, out=None)
457+
### <a name="trunc" href="#trunc">#</a> trunc(x, /, *, out=None)
457458

458459
Rounds each element `x_i` of the input array `x` to the integer-valued number that is closest to but no greater than `x_i`.
459460

0 commit comments

Comments
 (0)