Repository navigation
invalid signature for math.hypot #101123
Description
Activity
- addedtype-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error
on Jan 18, 2023 We don't have a rule that all docstrings have to be in a format edible by inspect? There are many docstrings that don't. This is just a simple
*args*function and I would rather not garbage-up the docstring with the funky looking text_signature notation.Reacted by Erlend E. AaslandThis is just a simple args function and I would rather not garbage-up the docstring with the funky looking text_signature notation.
@rhettinger, could you explain a bit more what it does break?
Here is how new docstring looks (just like other similar functions in the module, e.g. gcd and lcm, and how the rst docs for the hypot looks too):
>>> help(math.hypot) Help on built-in function hypot in module math: hypot(*coordinates) Multidimensional Euclidean distance from the origin to a point. Roughly equivalent to: sqrt(sum(x**2 for x in coordinates)) For a two dimensional point (x, y), gives the hypotenuse using the Pythagorean theorem: sqrt(x*x + y*y). For example, the hypotenuse of a 3/4/5 right triangle is: >>> hypot(3.0, 4.0) 5.0Here is the old:
>>> help(math.hypot) Help on built-in function hypot in module math: hypot(...) hypot(*coordinates) -> value Multidimensional Euclidean distance from the origin to a point. Roughly equivalent to: sqrt(sum(x**2 for x in coordinates)) For a two dimensional point (x, y), gives the hypotenuse using the Pythagorean theorem: sqrt(x*x + y*y). For example, the hypotenuse of a 3/4/5 right triangle is: >>> hypot(3.0, 4.0) 5.0Reacted by Erlend E. AaslandFYI: AC stuff is fast with #30312.
Reacted by Erlend E. Aasland- addedtype-featureA feature request or enhancementA feature request or enhancementextension-modulesC modules in the Modules dirC modules in the Modules dirand removedtype-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error
on Oct 27, 2024 @rhettinger, I'll reopen this as a feature request.
AC now supports *args processing, but it's coming with a slight performance penalty. One can be mitigated, using approach from #90370; I'm working on patch. With this, gcd/lcm could be converted to AC too (now these functions use "funky looking text_signature notation" (c) in docstrings).
Reacted by Erlend E. Aasland- added a commit that references this issue
on Oct 28, 2024 - linked a pull request that will close this issuegh-101123: Adapt vararg functions in the math module to Argument Clinic #126235
on Oct 31, 2024 - added a commit that references this issue
on Oct 31, 2024
This patch works:
Linked PRs