Commit 6548be0
committed
gh-131885: simplify function signatures in the cmath module
Now function docstrings are in sync with the module docs, for example:
```pycon
>>> import cmath, inspect
>>> help(cmath.sin)
Help on built-in function sin in module cmath:
sin(z)
Return the sine of z.
>>> inspect.signature(cmath.sin)
<Signature (z)>
```
As a side effect, this allows `sin(z=1.23)` calls. The price is slight
performance penalty (maybe this can be fixed on AC side):
| Benchmark | ref | patch |
|----------------|:------:|:--------------------:|
| sin(1.1) | 417 ns | 428 ns: 1.03x slower |
| sin(1j) | 414 ns | 422 ns: 1.02x slower |
| log(2.3) | 390 ns | 409 ns: 1.05x slower |
| log(1+2j) | 449 ns | 468 ns: 1.04x slower |
| log(2.1, 3.2) | 601 ns | 630 ns: 1.05x slower |
| Geometric mean | (ref) | 1.04x slower |1 parent ab38770 commit 6548be0
3 files changed
Lines changed: 834 additions & 118 deletions
File tree
- Misc/NEWS.d/next/Library
- Modules
- clinic
Lines changed: 2 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
0 commit comments