Issue46475
Created on 2022-01-22 22:48 by JelleZijlstra, last changed 2022-04-11 14:59 by admin. This issue is now closed.
| Pull Requests | |||
|---|---|---|---|
| URL | Status | Linked | Edit |
| PR 30842 | closed | JelleZijlstra, 2022-01-23 23:40 | |
| Messages (5) | |||
|---|---|---|---|
| msg411297 - (view) | Author: Jelle Zijlstra (JelleZijlstra) * ![]() |
Date: 2022-01-22 22:48 | |
At the moment, https://docs.python.org/3.10/library/typing.html#typing.NoReturn simply says: Special type indicating that a function never returns. In practice, type checkers accept NoReturn as a bottom type in other positions too. We should document this behavior. |
|||
| msg411301 - (view) | Author: Nikita Sobolev (sobolevn) * ![]() |
Date: 2022-01-22 23:12 | |
I agree. Plus, I cannot refrain from saying that it is generally quite hard to teach what "NoReturn" is. I start by explaining what bottom type and `void` is and then just say that in Python it is called `NoReturn`. I remember that there was a discussion about `Never` alias for it. Jelle, will you please push it? :) |
|||
| msg411309 - (view) | Author: Alex Waygood (AlexWaygood) * ![]() |
Date: 2022-01-22 23:48 | |
I also agree that documenting this is a great idea. It's already been adopted by large swathes of the typing community for use in this context. The value of having NoReturn act as a "bottom type" is evident. Time to make it official, in my opinion. |
|||
| msg411347 - (view) | Author: Jelle Zijlstra (JelleZijlstra) * ![]() |
Date: 2022-01-23 05:22 | |
Based on feedback here and on typing-sig I'm now leaning towards adding typing.Never along with typing.assert_never. I'll submit a single patch for these as the documentation will be closely linked. |
|||
| msg412860 - (view) | Author: Guido van Rossum (gvanrossum) * ![]() |
Date: 2022-02-08 18:50 | |
New changeset 243436f3779c1e7bed1fd4b23d5a8ec5eff40699 by Jelle Zijlstra in branch 'main': bpo-46475: Add typing.Never and typing.assert_never (GH-30842) https://github.com/python/cpython/commit/243436f3779c1e7bed1fd4b23d5a8ec5eff40699 |
|||
| History | |||
|---|---|---|---|
| Date | User | Action | Args |
| 2022-04-11 14:59:55 | admin | set | github: 90633 |
| 2022-02-08 19:07:21 | JelleZijlstra | set | status: open -> closed resolution: fixed stage: patch review -> resolved |
| 2022-02-08 18:50:33 | gvanrossum | set | messages: + msg412860 |
| 2022-01-31 02:22:42 | David Foster | set | nosy:
+ David Foster |
| 2022-01-23 23:40:30 | JelleZijlstra | set | keywords:
+ patch stage: patch review pull_requests: + pull_request29023 |
| 2022-01-23 05:22:07 | JelleZijlstra | set | type: enhancement title: Document use of NoReturn as a bottom type -> typing.Never and typing.assert_never messages: + msg411347 versions: - Python 3.9, Python 3.10 |
| 2022-01-22 23:48:29 | AlexWaygood | set | messages: + msg411309 |
| 2022-01-22 23:12:44 | sobolevn | set | messages: + msg411301 |
| 2022-01-22 22:48:28 | JelleZijlstra | set | components:
+ Library (Lib) versions: + Python 3.9, Python 3.10, Python 3.11 |
| 2022-01-22 22:48:21 | JelleZijlstra | create | |

