New submission from Giampaolo Rodola' <g.rod...@gmail.com>: As of right now socket.getaddrinfo() returns a sequence of 5-tuples reflecting family, type, protocol, canonname, and address of a socket:
>>> socket.getaddrinfo(None, 0) [(10, 1, 6, '', ('::1', 0, 0, 0)), (10, 2, 17, '', ('::1', 0, 0, 0)), (10, 3, 0, '', ('::1', 0, 0, 0)), (2, 1, 6, '', ('127.0.0.1', 0)), (2, 2, 17, '', ('127.0.0.1', 0)), (2, 3, 0, '', ('127.0.0.1', 0))] For readability it would be good if they were named tuples instead: >>> socket.getaddrinfo(None, 0)[0] addr_info(family=10, type=1, protocol=6, canonname='', address=('::1', 0, 0, 0)) Optionally, integers can be replaced by socket constant names: >>> socket.getaddrinfo(None, 0)[0] addr_info(family=socket.AF_INET6, type=socket.SOCK_STREAM, protocol=socket.IPPROTO_TCP, canonname='', address=('::1', 0, 0, 0)) ---------- components: Library (Lib) messages: 106916 nosy: exarkun, giampaolo.rodola, pitrou priority: normal severity: normal status: open title: socket.getaddrinfo() should return named tuples versions: Python 3.2 _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue8881> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com