mirror of
https://github.com/python/cpython.git
synced 2025-09-29 19:56:59 +00:00
gh-106310 - document the __signature__ attribute (#106311)
Document the __signature__ attribute Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
This commit is contained in:
parent
5dfa71769f
commit
b07f23259d
1 changed files with 5 additions and 0 deletions
|
@ -640,6 +640,9 @@ function.
|
||||||
Accepts a wide range of Python callables, from plain functions and classes to
|
Accepts a wide range of Python callables, from plain functions and classes to
|
||||||
:func:`functools.partial` objects.
|
: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
|
For objects defined in modules using stringized annotations
|
||||||
(``from __future__ import annotations``), :func:`signature` will
|
(``from __future__ import annotations``), :func:`signature` will
|
||||||
attempt to automatically un-stringize the annotations using
|
attempt to automatically un-stringize the annotations using
|
||||||
|
@ -763,6 +766,8 @@ function.
|
||||||
sig = MySignature.from_callable(min)
|
sig = MySignature.from_callable(min)
|
||||||
assert isinstance(sig, MySignature)
|
assert isinstance(sig, MySignature)
|
||||||
|
|
||||||
|
Its behavior is otherwise identical to that of :func:`signature`.
|
||||||
|
|
||||||
.. versionadded:: 3.5
|
.. versionadded:: 3.5
|
||||||
|
|
||||||
.. versionadded:: 3.10
|
.. versionadded:: 3.10
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue