From: Guido van Rossum Date: Fri, 9 Sep 2016 18:46:34 +0000 (-0700) Subject: Issue #28049: Add documentation for typing.Awaitable and friends. X-Git-Tag: v3.6.0b1~191 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=922175922cb92371b0086b0424ca37b515acf713;p=thirdparty%2FPython%2Fcpython.git Issue #28049: Add documentation for typing.Awaitable and friends. By Michael Lee. --- diff --git a/Doc/library/typing.rst b/Doc/library/typing.rst index 0139c75326b5..23bcc8c4155b 100644 --- a/Doc/library/typing.rst +++ b/Doc/library/typing.rst @@ -646,6 +646,18 @@ The module defines the following classes, functions and decorators: A generic version of :class:`collections.abc.ValuesView`. +.. class:: Awaitable(Generic[T_co]) + + A generic version of :class:`collections.abc.Awaitable`. + +.. class:: AsyncIterable(Generic[T_co]) + + A generic version of :class:`collections.abc.AsyncIterable`. + +.. class:: AsyncIterator(AsyncIterable[T_co]) + + A generic version of :class:`collections.abc.AsyncIterator`. + .. class:: ContextManager(Generic[T_co]) A generic version of :class:`contextlib.AbstractContextManager`. @@ -684,7 +696,7 @@ The module defines the following classes, functions and decorators: start += 1 Alternatively, annotate your generator as having a return type of - ``Iterator[YieldType]``:: + either ``Iterable[YieldType]`` or ``Iterator[YieldType]``:: def infinite_stream(start: int) -> Iterator[int]: while True: