Skip to content

Commit 39164cd

Browse files
authored
Recommend Never for return types as well (#2322)
1 parent 6ef9f77 commit 39164cd

1 file changed

Lines changed: 2 additions & 6 deletions

File tree

docs/guides/modernizing.rst

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -249,18 +249,14 @@ return types. For example, replace::
249249
from typing import NoReturn
250250

251251
def f(x: int, y: NoReturn) -> None: ...
252+
def g() -> NoReturn: ...
252253

253254
with::
254255

255256
from typing import Never # or typing_extensions.Never
256257

257258
def f(x: int, y: Never) -> None: ...
258-
259-
But keep ``NoReturn`` for return types::
260-
261-
from typing import NoReturn
262-
263-
def f(x: int) -> NoReturn: ...
259+
def g() -> Never: ...
264260

265261
.. _modernizing-type-aliases:
266262

0 commit comments

Comments
 (0)