Author ktbarrett
Recipients asvetlov, ktbarrett, yselivanov
Date 2021-06-10.07:34:22
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1623310462.97.0.487595968193.issue44373@roundup.psfhosted.org>
In-reply-to
Content
Following on from https://bugs.python.org/issue33544. I don't agree with the original suggestion to deprecate the wait() method on Events, but I do agree that Event should be made Awaitable. Doing so would make code more expressive, but more importantly improve the ability to use Events with generic code that can already handles the other Awaitable types in asyncio.

There were generally neutral takes on providing both __await__ and wait, besides Yury Selivanov who implied it was complex (???). I just tried the below, but maybe I'm missing something?


class AwaitableEvent(Awaitable[None], Event):

    def __await__(self) -> None:
        yield from self.wait().__await__()

    __iter__ = __await__
History
Date User Action Args
2021-06-10 07:34:22ktbarrettsetrecipients: + ktbarrett, asvetlov, yselivanov
2021-06-10 07:34:22ktbarrettsetmessageid: <1623310462.97.0.487595968193.issue44373@roundup.psfhosted.org>
2021-06-10 07:34:22ktbarrettlinkissue44373 messages
2021-06-10 07:34:22ktbarrettcreate