diff options
author | Gouvernathor <44340603+Gouvernathor@users.noreply.github.com> | 2023-10-20 22:54:02 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-10-20 22:54:02 (GMT) |
commit | b07f23259d30e61fd7cc975b8b0e3b2e846fed8f (patch) | |
tree | be387a9dfbc391ad4de016b8ed77c2053632ad47 /Doc/library | |
parent | 5dfa71769f547fffa893a89b0b04d963a41b2441 (diff) | |
download | cpython-b07f23259d30e61fd7cc975b8b0e3b2e846fed8f.zip cpython-b07f23259d30e61fd7cc975b8b0e3b2e846fed8f.tar.gz cpython-b07f23259d30e61fd7cc975b8b0e3b2e846fed8f.tar.bz2 |
gh-106310 - document the __signature__ attribute (#106311)
Document the __signature__ attribute
Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
Diffstat (limited to 'Doc/library')
-rw-r--r-- | Doc/library/inspect.rst | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/Doc/library/inspect.rst b/Doc/library/inspect.rst index 3efd3be..b463c0b 100644 --- a/Doc/library/inspect.rst +++ b/Doc/library/inspect.rst @@ -640,6 +640,9 @@ function. Accepts a wide range of Python callables, from plain functions and classes to :func:`functools.partial` objects. + If the passed object has a ``__signature__`` attribute, this function + returns it without further computations. + For objects defined in modules using stringized annotations (``from __future__ import annotations``), :func:`signature` will attempt to automatically un-stringize the annotations using @@ -763,6 +766,8 @@ function. sig = MySignature.from_callable(min) assert isinstance(sig, MySignature) + Its behavior is otherwise identical to that of :func:`signature`. + .. versionadded:: 3.5 .. versionadded:: 3.10 |