[Python-checkins] Document typing.NoReturn (GH-7107)

Ivan Levkivskyi webhook-mailer at python.org
Fri May 25 00:34:04 EDT 2018


https://github.com/python/cpython/commit/6e413f4327a68c4c7d62e0b6d0f9144be11dd6cd
commit: 6e413f4327a68c4c7d62e0b6d0f9144be11dd6cd
branch: master
author: Ivan Levkivskyi <levkivskyi at gmail.com>
committer: GitHub <noreply at github.com>
date: 2018-05-24T21:33:55-07:00
summary:

Document typing.NoReturn (GH-7107)

files:
M Doc/library/typing.rst

diff --git a/Doc/library/typing.rst b/Doc/library/typing.rst
index be6636eea08f..91d10e324cae 100644
--- a/Doc/library/typing.rst
+++ b/Doc/library/typing.rst
@@ -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.



More information about the Python-checkins mailing list