Skip to content
Prev Previous commit
Next Next commit
Use a positional-only argument named method
Summary:

Test Plan:

Reviewers:

Subscribers:

Tasks:

Tags:
  • Loading branch information
stroxler committed Feb 27, 2023
commit 090d9d294a889b833372342cd65ed129e1984bd9
6 changes: 3 additions & 3 deletions Lib/typing.py
Original file line number Diff line number Diff line change
Expand Up @@ -3455,7 +3455,7 @@ def decorator(cls_or_fn):



def override(__arg: F) -> F:
def override(method: F, /) -> F:
"""Indicate that a method is intended to override a method in a base class.

Usage:
Expand All @@ -3482,10 +3482,10 @@ def method(self) -> None:

"""
try:
__arg.__override__ = True
method.__override__ = True
except (AttributeError, TypeError):
# Skip the attribute silently if it is not writable.
# AttributeError happens if the object has __slots__ or a
# read-only property, TypeError if it's a builtin class.
pass
return __arg
return method