Issue 33544: Asyncio Event.wait() is a hold over from before awaitable, and should be awaitable (original) (raw)

Issue33544

Created on 2018-05-16 16:57 by fried, last changed 2022-04-11 14:59 by admin. This issue is now closed.

Pull Requests
URL Status Linked Edit
PR 6916 closed fried,2018-05-16 18:15
Messages (5)
msg316842 - (view) Author: Jason Fried (fried) * Date: 2018-05-16 16:57
wait is a very overloaded word in asyncio. Events and Conditions are not consistent with the rest of asyncio. Why don't Future and Task have wait() methods? well because they are awaitable Some subjective reasoning: Every time I go to use one of these things, I attempt to await them like everything else in the Asyncio world and get a nice exception for it. await event vs await event.wait() I propose we make conditions and events awaitable and deprecate the .wait or at-least remove it from the documentation.
msg316847 - (view) Author: Jason Fried (fried) * Date: 2018-05-16 18:09
Removed Condition from this request, because it has an __await__ method for supporting the the deprecated pattern with async cond: I'll open a different bug, for Condition behavior for 3.9 when we can remove the deprecated pattern.
msg316853 - (view) Author: Hrvoje Nikšić (hniksic) * Date: 2018-05-16 19:30
Deprecating Event.wait would be incorrect because Event was designed to mimic the threading.Event class which has a (blocking) wait() method[1]. Supporting `await event` is still worthwhile, though. [1] https://docs.python.org/2/library/threading.html#threading.Event.wait
msg316962 - (view) Author: Yury Selivanov (yselivanov) * (Python committer) Date: 2018-05-17 16:42
> Deprecating Event.wait would be incorrect because Event was designed to mimic the threading.Event class which has a (blocking) wait() method[1]. This is rather important. I'd like to continue maintaining this similarity. Adding 'await event' would be similar (in a way) to making instances of threading.Event callable. So deprecation of '.wait()' isn't something we will do. Having *both* 'await event.wait()' and 'await event' worries me. IMO the slight readability improvement isn't worth the added complexity.
msg317113 - (view) Author: Andrew Svetlov (asvetlov) * (Python committer) Date: 2018-05-19 11:19
-1 for the proposal
History
Date User Action Args
2022-04-11 14:59:00 admin set github: 77725
2018-05-21 09:31:38 asvetlov set status: open -> closedresolution: rejectedstage: patch review -> resolved
2018-05-19 11:19:17 asvetlov set messages: +
2018-05-17 16:42:48 yselivanov set messages: +
2018-05-16 19:30:00 hniksic set nosy: + hniksicmessages: +
2018-05-16 18:15:50 fried set keywords: + patchstage: patch reviewpull_requests: + <pull%5Frequest6584>
2018-05-16 18:09:03 fried set messages: + title: Asyncio Event.wait() and Condition.wait() is a hold over from before awaitable, and should be awaitable -> Asyncio Event.wait() is a hold over from before awaitable, and should be awaitable
2018-05-16 16:57:54 fried create