[docs] [issue38178] Remove explicit "loop" argument from EchoClientProtocol example

STINNER Victor report at bugs.python.org
Mon Sep 16 04:15:20 EDT 2019


STINNER Victor <vstinner at python.org> added the comment:

> In modern asyncio code the explicit loop arguments are no longer used since the loop can always be obtained with get_running_loop().

Yeah, the trend changed. Around Python 3.4, passing explicitly loop was preferred for best performances.

Since that time, the code to get the current loop has been optimized, and the new trend is to make the loop implicit to make the code more readable.

--

When I wrote the doc, self.loop.stop() was called explicitly:

https://docs.python.org/3.5/library/asyncio-protocol.html#tcp-echo-client-protocol

It seems like the example has been modified to add a new "on_con_lost" Future.

--

Anyway, thanks Hrvoje Nikšić for your contribution ;-)

----------

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue38178>
_______________________________________


More information about the docs mailing list