tornado
tornado copied to clipboard
WaitIterator constructor typing is not match with documentation
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.
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.