Skip to content

stdlib: Use Never instead of NoReturn #13893

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

donBarbos
Copy link
Contributor

@donBarbos donBarbos commented Apr 27, 2025

related #13891


2025-04-28 (@srittau): Deferred until there's a final decision in python/cpython#132941.

@donBarbos donBarbos marked this pull request as ready for review April 27, 2025 13:43
@srittau
Copy link
Collaborator

srittau commented Apr 27, 2025

I see this as a regression. Using NoReturn instead of Never for return types is clearer. There is no intent for deprecating NoReturn that I know of.

Copy link
Contributor

According to mypy_primer, this change has no effect on the checked open source code. 🤖🎉

@Avasam
Copy link
Collaborator

Avasam commented Apr 27, 2025

Edit: I responded on the related issue: #13891 (comment)

Whilst they are equivalent. There's a semantic difference. And typeshed is no stranger to using type name alias to express different semantic (Incomplete, Unused, MaybeNone, ...) I'm -1 on this.

If python/cpython#132941 is accepted to where NoReturn is considered (soft) deprecated and there's a general agreement in the Python typing community to no longer use NoReturn, then maybe.

But as it stands:

Never is not the preferred name for return types.

I can get behind the semantic of "a function that Never returns". But I'd want widespread agreement before changing in typeshed.

@srittau srittau added the status: deferred Issue or PR deferred until some precondition is fixed label Apr 28, 2025
@srittau
Copy link
Collaborator

srittau commented Apr 28, 2025

Marking as deferred, pending the outcome of the discussion (and merged PR) of python/cpython#132941.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: deferred Issue or PR deferred until some precondition is fixed
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants