Skip to content

stdlib: Use Never instead of NoReturn#13893

Open
donbarbos wants to merge 1 commit intopython:mainfrom
donbarbos:use-never
Open

stdlib: Use Never instead of NoReturn#13893
donbarbos wants to merge 1 commit intopython:mainfrom
donbarbos:use-never

Conversation

@donbarbos
Copy link
Copy Markdown
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
Copy Markdown
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.

@github-actions
Copy link
Copy Markdown
Contributor

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

@Avasam
Copy link
Copy Markdown
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
Copy Markdown
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