Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Alex feedback
  • Loading branch information
JelleZijlstra committed May 18, 2026
commit 086c6a68c71ff6a06e20cf39284b1be2b1c684e6
7 changes: 3 additions & 4 deletions Lib/typing.py
Original file line number Diff line number Diff line change
Expand Up @@ -2687,7 +2687,7 @@ def _overload_dummy(*args, **kwds):
def overload(func):
"""Decorator for overloaded functions/methods.

In a stub file, place two or more stub definitions for the same
In a non-stub file, place two or more stub definitions for the same
function in a row, each decorated with @overload, followed
with an implementation. The implementation should *not*
Comment thread
JelleZijlstra marked this conversation as resolved.
Outdated
be decorated with @overload::
Expand All @@ -2701,8 +2701,8 @@ def utf8(value: str) -> bytes: ...
def utf8(value):
... # implementation goes here

In a stub file or in a Protocol definition, the implementation
should be omitted::
In a stub file or in an abstract method (for example, in a Protocol definition),
the implementation may be omitted::

@overload
def utf8(value: None) -> None: ...
Expand All @@ -2711,7 +2711,6 @@ def utf8(value: bytes) -> bytes: ...
@overload
def utf8(value: str) -> bytes: ...


The overloads for a function can be retrieved at runtime using the
get_overloads() function.
"""
Expand Down
Loading