Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

gh-106310 - document the __signature__ attribute #106311

Merged
merged 2 commits into from
Oct 20, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions Doc/library/inspect.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
Loading