Skip to content

Commit 6548be0

Browse files
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

File tree

3 files changed

+834
-118
lines changed

3 files changed

+834
-118
lines changed
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
Simplify function signatures in the :mod:`cmath` module, e.g. ``sin(z)``
2+
instead of ``sin(z, /)``. Patch by Sergey B Kirpichev.

0 commit comments

Comments
 (0)