Skip to content

Commit 9a6ea49

Browse files
committed
Add typing_extensions infobox for Never
1 parent b9c365e commit 9a6ea49

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

docs/guides/unreachable.rst

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,11 @@ As an example, consider this simple calculator:
7272
case _:
7373
assert_never(op)
7474
75+
.. note::
76+
77+
To use this feature on Python versions earlier than 3.11, you will need to
78+
import ``Never`` from ``typing_extensions`` (version 4.1 or newer).
79+
7580
The ``match`` statement covers all members of the ``Op`` enum,
7681
so the ``assert_never()`` call is unreachable and the type checker
7782
will accept this code. However, if you add another member to the

0 commit comments

Comments
 (0)