Message326864
FYI if I recall correctly, in the past, we preferred to pass explicitly the loop to avoid to have to get the current loop which may add an overhead. But the current trend is to get rid of the explicit loop parameter.
> asyncio.sleep is a coroutine; passing a *loop* argument to it makes no sense anymore.
sleep() requires the current event loop:
if loop is None:
loop = events.get_running_loop()
else:
warnings.warn("The loop argument is deprecated and scheduled for "
"removal in Python 3.10.",
DeprecationWarning, stacklevel=2)
future = loop.create_future()
h = loop.call_later(delay,
futures._set_result_unless_cancelled,
future, result)
Why does it not make sense to pass the loop to sleep? "it makes no sense anymore" something changes?
I'm not against the change, I'm just trying to understand the rationale for other changes :-) |
|
Date |
User |
Action |
Args |
2018-10-02 07:44:32 | vstinner | set | recipients:
+ vstinner, asvetlov, serhiy.storchaka, yselivanov, willingc, xtreak, fbidu |
2018-10-02 07:44:32 | vstinner | set | messageid: <1538466272.4.0.545547206417.issue34728@psf.upfronthosting.co.za> |
2018-10-02 07:44:32 | vstinner | link | issue34728 messages |
2018-10-02 07:44:32 | vstinner | create | |
|