Skip to content

Commit 7d3cbaf

Browse files
committed
Document abstract overloads
1 parent b065c73 commit 7d3cbaf

File tree

1 file changed

+20
-1
lines changed

1 file changed

+20
-1
lines changed

CHANGELOG.md

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,26 @@ This release includes several fixes to inconsistent resolution of attribute, met
124124

125125
### Make Implementation for Abstract Overloads Optional
126126

127-
* Allow omitting implementation for abstract overloads (Ivan Levkivskyi, PR [18882](https://github.com/python/mypy/pull/18882))
127+
The implementation can now be omitted for abstract overloaded methods,
128+
even outside stubs:
129+
130+
```py
131+
from abc import abstractmethod
132+
from typing import overload
133+
134+
class C:
135+
@abstractmethod
136+
@overload
137+
def foo(self, x: int) -> int: ...
138+
139+
@abstractmethod
140+
@overload
141+
deef foo(self, x: str) -> str: ...
142+
143+
# No implementation required for "foo"
144+
```
145+
146+
This was contributed by Ivan Levkivskyi (PR [18882](https://github.com/python/mypy/pull/18882)).
128147

129148
### Option to Exclude Everything in .gitignore
130149

0 commit comments

Comments
 (0)