# HG changeset patch # Parent 256d5c7146cb968e9d6e200c99b0a1ec9e2faf14 diff -r 256d5c7146cb Doc/library/types.rst --- a/Doc/library/types.rst Wed Jul 29 12:55:33 2015 +1200 +++ b/Doc/library/types.rst Wed Jul 29 02:32:24 2015 +0000 @@ -288,16 +288,22 @@ This function transforms a :term:`generator` function into a :term:`coroutine function` which returns a generator-based coroutine. - The generator-based coroutine is still a :term:`generator iterator`, + + If *gen_func* is a generator function and is not already a + coroutine function, it will be modified in-place. The object returned + by the modified function is still a :term:`generator iterator`, but is also considered to be a :term:`coroutine` object and is :term:`awaitable`. However, it may not necessarily implement the :meth:`__await__` method. - If *gen_func* is a generator function, it will be modified in-place. + If *gen_func* is already a coroutine function, including a generator-based + function that has already been modified, it is returned as is. - If *gen_func* is not a generator function, it will be wrapped. If it - returns an instance of :class:`collections.abc.Generator`, the instance - will be wrapped in an *awaitable* proxy object. All other types + If *gen_func* is not a generator nor a coroutine function, it will be + wrapped, and the return value of *gen_func* will be inspected. If it + returns an instance of :class:`collections.abc.Generator` that is not + also an instance of :class:`collections.abc.Coroutine`, the instance + will be wrapped in a coroutine proxy object. All other types of objects will be returned as is. .. versionadded:: 3.5