[Python-ideas] socket module: plain stuples vs named tuples
George Fischhof
george at fischhof.hu
Mon Jun 19 17:09:12 EDT 2017
+1 ;-)
for example to get IP address of all interfaces we have to use the third
(indexed as 2) member of "something" it is much more beatiful to get
ip_address:
*import *socket
*for *ip *in *socket.gethostbyname_ex(socket.gethostname())[2]:
print(ip)
BR,
George
2017-06-13 22:13 GMT+02:00 Thomas Güttler <guettliml at thomas-guettler.de>:
> AFAIK the socket module returns plain tuples in Python3:
>
> https://docs.python.org/3/library/socket.html
>
> Why not use named tuples?
>
> Regards,
> Thomas Güttler
>
> --
> I am looking for feedback for my personal programming guidelines:
> https://github.com/guettli/programming-guidelines
> _______________________________________________
> Python-ideas mailing list
> Python-ideas at python.org
> https://mail.python.org/mailman/listinfo/python-ideas
> Code of Conduct: http://python.org/psf/codeofconduct/
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20170619/c8168de8/attachment.html>
More information about the Python-ideas
mailing list