Skip to content

Commit

Permalink
Explain special treatment of Never/NoReturn
Browse files Browse the repository at this point in the history
  • Loading branch information
jacobtylerwalls committed Jun 20, 2024
1 parent 4ba7b79 commit 33a520f
Showing 1 changed file with 5 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,11 @@ You can use ``assert_never`` to mark exhaustive choices:
if suffix in "dmy":
handle_date_suffix(suffix)

Or, instead of `assert_never()`, you can call a function with a return
annotation of `Never` or `NoReturn`. Unlike in the general case, where
by design pylint ignores type annotations and does its own static analysis,
here, pylint treats these special annotations like a disable comment.

Pylint currently allows repeating the same test like this, even though this
lets some error cases through, as pylint does not assess the intervening code:

Expand Down

0 comments on commit 33a520f

Please sign in to comment.