We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent c461aa9 commit 6ab5118Copy full SHA for 6ab5118
Doc/library/typing.rst
@@ -973,6 +973,16 @@ using ``[]``.
973
case _:
974
never_call_me(arg) # OK, arg is of type Never (or NoReturn)
975
976
+ Or to define an empty container that must remain empty::
977
+
978
+ from typing import Never
979
980
+ empty_list: list[Never] = []
981
+ empty_list.append(1) # type checker error
982
983
+ empty_dict: dict[Never, Never] = {}
984
+ empty_dict['key'] = 'value' # type checker error
985
986
:data:`!Never` and :data:`!NoReturn` have the same meaning in the type system
987
and static type checkers treat both equivalently.
988
0 commit comments