Skip to content

Commit

Permalink
pythongh-106310 - document the __signature__ attribute (pythonGH-106311)
Browse files Browse the repository at this point in the history
Document the __signature__ attribute

(cherry picked from commit b07f232)

Co-authored-by: Gouvernathor <44340603+Gouvernathor@users.noreply.github.com>
Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
  • Loading branch information
2 people authored and miss-islington committed Oct 20, 2023
1 parent 9addf2c commit cd678d6
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions Doc/library/inspect.rst
Original file line number Diff line number Diff line change
Expand Up @@ -619,6 +619,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 @@ -738,6 +741,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

0 comments on commit cd678d6

Please sign in to comment.