Victor, ok. Coroutine call returns generator. But usually I want to know what is return type of that generator object.
I'm with Ben Darnell: coroutine decorator is more like classmethod than return type. On Thu, Feb 12, 2015 at 6:35 PM, Ben Darnell <b...@bendarnell.com> wrote: > On Thu, Feb 12, 2015 at 11:31 AM, Victor Stinner <victor.stin...@gmail.com> > wrote: >> >> 2015-02-12 17:12 GMT+01:00 Andrew Svetlov <andrew.svet...@gmail.com>: >> > I like to have simple markup for coroutines but -1 for using return >> > annotation for that. >> > Return annotation is for return value description, not for function >> > itself. >> >> A coroutine function returns a coroutine object. So the annotation "-> >> coroutine" is correct, no? > > > But then the coroutine object has a return type as well, which needs to be > represented somehow. I think it's better to let the "return type" portion of > the docs represent the eventual return value of the coroutine. The coroutine > aspect of the function is most analogous to staticmethods and classmethods, > which are given a special prefix in the docs: > https://docs.python.org/3/library/stdtypes.html?highlight=fromkeys#dict.fromkeys > > Unfortunately it looks like these are built into sphinx so it's not as easy > to add a new one (unless I'm missing something), but this seems like a good > addition for the next version of sphinx. > > -Ben > >> >> >> Victor > > -- Thanks, Andrew Svetlov