Get a callable's signature with inspect.signature
Answer: The Signature object represents the call signature of a callable object and its return annotation. Retrieve it with the signature() function. PEP 362 proposes this representation because the older introspection data was spread across a half-dozen deeply nested attributes.
What you get
inspect.signature(callable) returns a Signature for the given callable. The object also has a return annotation. Parameter objects and BoundArguments are part of the same design in the PEP. Some functions may not be introspectable.
Caching
The PEP discusses implicit caching of Signature objects. If the Signature object is cached, later changes to the function it describes will not be reflected in it. Caching can be always done manually.
| Signature | inspect | |---|---| | Signature | Call signature of a callable object and its return annotation | | signature() | Function that retrieves a Signature | | Parameter | Object in the PEP for one parameter | | BoundArguments | Object for arguments bound to a signature |
See also
Claims
- id: C1 claim: PEP 362 proposes a new representation for function signatures. source: S1 evidence: "This PEP proposes a new representation for function signatures"
- id: C2 claim: The Signature object represents a callable's call signature and return annotation. source: S2 evidence: "The Signature object represents the call signature of a callable object"
- id: C3 claim: inspect.signature() returns that object for a callable. source: S2 evidence: "To retrieve a Signature object, use the signature() function"
Sources
- [S1] PEP 362 – Function Signature Object. Python PEPs. https://peps.python.org/pep-0362/ . License: Public-Domain. Accessed 2026-11-19.
- [S2] inspect — Inspect live objects. Python docs. https://docs.python.org/3/library/inspect.html . License: PSF-2.0. Accessed 2026-11-19.
License: this note is CC BY 4.0 (https://creativecommons.org/licenses/by/4.0/). Summary by iinventedlight (AI-assisted). Sources: Python PEPs, PEP 362 – Function Signature Object; Python docs, inspect — Inspect live objects. Public-Domain; PSF-2.0. Text was condensed and changed from the originals.
License: CC-BY-4.0 · Summary by iinventedlight (AI-assisted). Sources: Python PEPs, PEP 362 – Function Signature Object; Python docs, inspect — Inspect live objects. Public-Domain; PSF-2.0.
Cite this
iinventedlight. 2026. "Get a callable's signature with inspect.signature." iinventedlight Library, iil:note:9brg8dr5, version of 2026-11-19. https://iinventedlight.com/library/notes/python-inspect-signature/. License: CC-BY-4.0.
@misc{iil_note_9brg8dr5,
author = {{iinventedlight}},
title = {{Get a callable's signature with inspect.signature}},
howpublished = {iinventedlight Library},
year = {2026},
date = {2026-11-19},
url = {https://iinventedlight.com/library/notes/python-inspect-signature/},
note = {Permanent ID iil:note:9brg8dr5. License: CC-BY-4.0.},
}
Spotted a mistake? Use the MCP feedback tool or email hello@iinventedlight.com. Or Report a correction (no account needed).
Extra files beside this note
These files use this note's license, shown below. Paper extras retain their reproduction status; a link is not a reproduction.
- python-inspect-signature.table.json (table; CC-BY-4.0)
- python-inspect-signature.schema.json (schema; CC-BY-4.0)
For language models and agents: start at /llms.txt | /agents.md | /.well-known/agent-library.json. This page in Markdown: /library/notes/python-inspect-signature.md.