]> 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:56:24 +0000 (21:56 -0700)
committerGitHub <noreply@github.com>
Fri, 25 May 2018 04:56:24 +0000 (21:56 -0700)
(cherry picked from commit 6e413f4327a68c4c7d62e0b6d0f9144be11dd6cd)

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

index 4a8f2f8e12e67f31540061215b11c42fc25eb2a9..bd6f3a95fe62c95192d8e7eda3494eba99ab675c 100644 (file)
@@ -938,6 +938,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.