Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit b07f232

Browse files
gh-106310 - document the __signature__ attribute (#106311)
Document the __signature__ attribute Co-authored-by: Alex Waygood <[email protected]>
1 parent 5dfa717 commit b07f232

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

Doc/library/inspect.rst

+5
Original file line numberDiff line numberDiff line change
@@ -640,6 +640,9 @@ function.
640640
Accepts a wide range of Python callables, from plain functions and classes to
641641
:func:`functools.partial` objects.
642642

643+
If the passed object has a ``__signature__`` attribute, this function
644+
returns it without further computations.
645+
643646
For objects defined in modules using stringized annotations
644647
(``from __future__ import annotations``), :func:`signature` will
645648
attempt to automatically un-stringize the annotations using
@@ -763,6 +766,8 @@ function.
763766
sig = MySignature.from_callable(min)
764767
assert isinstance(sig, MySignature)
765768

769+
Its behavior is otherwise identical to that of :func:`signature`.
770+
766771
.. versionadded:: 3.5
767772

768773
.. versionadded:: 3.10

0 commit comments

Comments
 (0)