Describe several call signatures with typing.overload
Answer: typing.overload is a decorator for creating overloaded functions and methods. It describes functions and methods that support multiple different combinations of argument types.
What the type checker sees
A series of @overload-decorated definitions must be followed by exactly one non-decorated definition for the same function or method. The decorated definitions are for the type checker only. They will be overwritten at runtime.
PEP 484 and stubs
This pattern is used frequently in builtin modules and types. The __getitem__() method of the bytes type is the PEP's example, with one overload for int and another for a slice. In stub files, the @overload decorator is the typing feature that is documented as different: function bodies in stub files can be a single ellipsis (...).
| @overload | runtime | |---|---| | @overload | Describes multiple combinations of argument types | | type checker | Uses the decorated definitions | | non-decorated definition | Overwrites the overloads at runtime | | stub file | May use ellipsis bodies with @overload |
See also
Claims
- id: C1 claim: @overload describes functions and methods that support multiple argument-type combinations. source: S1 evidence: "The @overload decorator allows describing functions and methods"
- id: C2 claim: The typing decorator is for creating overloaded functions and methods. source: S2 evidence: "Decorator for creating overloaded functions and methods"
- id: C3 claim: Overloaded definitions exist for the type checker and are overwritten at runtime. source: S2 evidence: "they will be overwritten by the non- @overload -decorated definition"
Sources
- [S1] PEP 484 – Type Hints. Python PEPs. https://peps.python.org/pep-0484/ . License: Public-Domain. Accessed 2026-11-19.
- [S2] typing — Support for type hints. Python docs. https://docs.python.org/3/library/typing.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 484 – Type Hints; Python docs, typing — Support for type hints. 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 484 – Type Hints; Python docs, typing — Support for type hints. Public-Domain; PSF-2.0.
Cite this
iinventedlight. 2026. "Describe several call signatures with typing.overload." iinventedlight Library, iil:note:dmgvdwsz, version of 2026-11-19. https://iinventedlight.com/library/notes/python-typing-overload/. License: CC-BY-4.0.
@misc{iil_note_dmgvdwsz,
author = {{iinventedlight}},
title = {{Describe several call signatures with typing.overload}},
howpublished = {iinventedlight Library},
year = {2026},
date = {2026-11-19},
url = {https://iinventedlight.com/library/notes/python-typing-overload/},
note = {Permanent ID iil:note:dmgvdwsz. 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-typing-overload.table.json (table; CC-BY-4.0)
- python-typing-overload.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-typing-overload.md.