<html><head><meta http-equiv="Content-Type" content="text/html charset=us-ascii"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class="">asyncio is a great library which with recent changes in 3.5 was made even better.<div class=""><br class=""></div><div class="">However there is an inconvenience that bothers me and looks very unnatural: inability to access event loop</div><div class="">that executes a coroutine from within that coroutine.</div><div class=""><br class=""><div class="">This is unnatural, because we have `self` and `cls` to access object from a method it is bound to,</div><div class="">we have `current_thread` to get an instance of Thread that currently executes code, but for a coroutine</div><div class="">we have no such method, we cannot get its context of execution.</div><div class="">Current implementation of `get_event_loop` method is not sufficient, it will not work if thread has more</div><div class="">than one event loop.</div><div class=""><br class=""></div><div class="">I think Python would benefit from providing either a new method (e.g. `asyncio.current_event_loop`) or modifying `asyncio.get_event_loop`</div><div class="">to return current event loop when called from a coroutine. It should, in my opinion, reduce necessity of passing event loop</div><div class="">between coroutines in application's code as it is done in asyncio itself and 3rd party libraries (like aiohttp).</div></div><br class=""><br class=""><div class="">
<span class="Apple-style-span" style="border-collapse: separate; color: rgb(0, 0, 0); font-family: Helvetica; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;  "><div class="">Best Regards,</div><div class="">Ilya Kulakov</div><div class=""><br class=""></div></span></div></body></html>