summaryrefslogtreecommitdiffstats
path: root/Doc/library/inspect.rst
diff options
context:
space:
mode:
authorNikita Sobolev <mail@sobolevn.me>2023-12-02 23:39:43 (GMT)
committerGitHub <noreply@github.com>2023-12-02 23:39:43 (GMT)
commita9574c68f04695eecd19866faaf4cdee5965bc70 (patch)
tree6c4738f5b6b8e92c7fe8716418fb8b26a633e703 /Doc/library/inspect.rst
parent0229d2a9b1d6ce6daa6a773f92e3754e7dc86d50 (diff)
downloadcpython-a9574c68f04695eecd19866faaf4cdee5965bc70.zip
cpython-a9574c68f04695eecd19866faaf4cdee5965bc70.tar.gz
cpython-a9574c68f04695eecd19866faaf4cdee5965bc70.tar.bz2
gh-112139: Add `inspect.Signature.format` and use it in `pydoc` (#112143)
Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
Diffstat (limited to 'Doc/library/inspect.rst')
-rw-r--r--Doc/library/inspect.rst11
1 files changed, 11 insertions, 0 deletions
diff --git a/Doc/library/inspect.rst b/Doc/library/inspect.rst
index 94c5d1c..0852251 100644
--- a/Doc/library/inspect.rst
+++ b/Doc/library/inspect.rst
@@ -753,6 +753,17 @@ function.
Signature objects are also supported by generic function
:func:`copy.replace`.
+ .. method:: format(*, max_width=None)
+
+ Convert signature object to string.
+
+ If *max_width* is passed, the method will attempt to fit
+ the signature into lines of at most *max_width* characters.
+ If the signature is longer than *max_width*,
+ all parameters will be on separate lines.
+
+ .. versionadded:: 3.13
+
.. classmethod:: Signature.from_callable(obj, *, follow_wrapped=True, globals=None, locals=None, eval_str=False)
Return a :class:`Signature` (or its subclass) object for a given callable