Skip to content

WaitIterator constructor typing is not match with documentation #3001

Open

Description

@schaumb

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.

Activity

  1. bdarnell commented on Aug 23, 2023

    @bdarnell
    Member

    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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions