]> granicus.if.org Git - python/commitdiff
Document typing.NoReturn (GH-7107)
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>
Fri, 25 May 2018 04:51:14 +0000 (21:51 -0700)
committerGitHub <noreply@github.com>
Fri, 25 May 2018 04:51:14 +0000 (21:51 -0700)
(cherry picked from commit 6e413f4327a68c4c7d62e0b6d0f9144be11dd6cd)

Co-authored-by: Ivan Levkivskyi <levkivskyi@gmail.com>
Doc/library/typing.rst

index be6636eea08fbb8f13176eb3999920b6549d44d7..91d10e324cae296762427bb154b8dcee76d255f4 100644 (file)
@@ -937,6 +937,18 @@ The module defines the following classes, functions and decorators:
    * Every type is compatible with :data:`Any`.
    * :data:`Any` is compatible with every type.
 
+.. data:: NoReturn
+
+   Special type indicating that a function never returns.
+   For example::
+
+      from typing import NoReturn
+
+      def stop() -> NoReturn:
+          raise RuntimeError('no way')
+
+   .. versionadded:: 3.6.5
+
 .. data:: Union
 
    Union type; ``Union[X, Y]`` means either X or Y.