tornado icon indicating copy to clipboard operation
tornado copied to clipboard

WaitIterator constructor typing is not match with documentation

Open schaumb opened this issue 4 years ago • 1 comments

tornado.gen.WaitIterator constructor parameters are can be Awaitable-s based on documentation, but the constructor typing says only Future https://github.com/tornadoweb/tornado/blob/master/tornado/gen.py#L367

The Waititerator works as expected on tornado.locks.Event().wait(), but the mypy fails on it.

schaumb avatar Mar 18 '21 12:03 schaumb

The typing is accurate; the docs are wrong. WaitIterator does not currently work with all awaitables, only Futures. (Event.wait returns a Future even though its typing says Awaitable)

However, I think it's better to make the code behave as documented than to change the docs to match the code.

bdarnell avatar Aug 23 '23 01:08 bdarnell