diff options
author | Miss Islington (bot) <31488909+miss-islington@users.noreply.github.com> | 2023-10-23 15:49:12 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-10-23 15:49:12 (GMT) |
commit | 6a5aab0cb40672892eba4f5b0df5759505d7e5b9 (patch) | |
tree | fca2913990e0d40f63f8453a0aa45546d0f6043c /Doc/library/inspect.rst | |
parent | d4d947dd718c49e75f55e3b13bb7645b839d45b5 (diff) | |
download | cpython-6a5aab0cb40672892eba4f5b0df5759505d7e5b9.zip cpython-6a5aab0cb40672892eba4f5b0df5759505d7e5b9.tar.gz cpython-6a5aab0cb40672892eba4f5b0df5759505d7e5b9.tar.bz2 |
[3.12] gh-106310 - document the __signature__ attribute (GH-106311) (#111145)
Co-authored-by: Gouvernathor <44340603+Gouvernathor@users.noreply.github.com>
Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
Diffstat (limited to 'Doc/library/inspect.rst')
-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 23dde26..9f0b965 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 @@ -760,6 +763,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 |