-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feature Request: Named tuples for result of laddr in net_connections() #928
Comments
Sounds reasonable. |
Actually hang on: addresses my either be a tuple in case of AF_INET (IPv4) sockets or a string in case of AF_INET6 (IPv6) sockets, so that's why back then I opted for a raw tuple. |
That is new to me. I have not worked with ipv6 before. Is there no integer port number? |
I'm sorry, I meant AF_UNIX sockets, not IPv6. With those, the address is a string, not a tuple. |
I think I'm gonna reject this for consistency with |
Yes, you are right. Symmetry would be nice. I think socket.getsockname() should return a named tuple. I asked at the python-ideas mailing list. But nobody seems to care: https://mail.python.org/pipermail/python-ideas/2017-June/046028.html Up to now there is no reply. Maybe this is the wrong mailing list ... |
.... Great, Guido V R is open for pull requests if someone wants to implement named tuples for the socket library. There were +1 votes, too (and some concern about python startup time). See https://mail.python.org/pipermail/python-ideas/2017-June/046086.html I stopped coding in spare time, since my children are more important at the moment .. if some wants to try it ... go ahead and implement named tuples for the socket standard library - would be great. |
OK this is now fixed. |
Up to now you need ugly index numbers to access the port in laddr tuple.
Example:
('10.0.0.1', 48776)
It would be nice to have a named tuple.
Is there a good reason against it?
The text was updated successfully, but these errors were encountered: