Yury Selivanov <yseliva...@gmail.com> added the comment:

[victor]
> Why does it not make sense to pass the loop to sleep? "it makes no sense 
> anymore" something changes?

[andrew]
`loop` argument passed to sleep should be always the same as returned from 
`get_running_loop()`.

What Andrew said.

Basically, it wasn't *ever* possible to pass a loop to sleep() that would be 
different from the loop that would run it, because sleep() is a *coroutine*.

In asyncio some APIs are functions and some are coroutines.

* asyncio.gather(), for example, is a function.  You can call it from top-level 
code (and pass an event loop to it) or from a coroutine.

* asyncio.sleep(), wait(), and wait_for() are *coroutines*; they can only be 
called from other coroutines or if you wrap them into a Task; in all cases, 
*loop* is always 100% defined for them.

Passing the loop isn't even a viable micro-optimization, it's just pointless.  
This extra argument just adds to the confusion and promotes bad patterns, so we 
want to eventually remove it.

----------
resolution:  -> fixed
stage: patch review -> resolved
status: open -> closed

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue34728>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to