STINNER Victor <vstin...@python.org> added the comment:

I agree that all socket addresses must be listed. But I would prefer to write a 
single line. Maybe something like:

addresses = ', '.join(sock.getsockname() for sock in server.sockets)
print('Serving on {addresses}')

Do you want to propose a PR to enhance the example?

----------
nosy: +vstinner
title: List all sockets in TCP echo server using streams -> asyncio doc: List 
all sockets in TCP echo server using streams
versions: +Python 3.11

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

Reply via email to