Skip to content
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

Closed
guettli opened this issue Oct 24, 2016 · 8 comments
Closed

Comments

@guettli
Copy link
Contributor

guettli commented Oct 24, 2016

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?

@giampaolo
Copy link
Owner

Sounds reasonable.

@giampaolo
Copy link
Owner

giampaolo commented Oct 24, 2016

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.

@guettli
Copy link
Contributor Author

guettli commented Oct 25, 2016

That is new to me. I have not worked with ipv6 before. Is there no integer port number?

@giampaolo
Copy link
Owner

I'm sorry, I meant AF_UNIX sockets, not IPv6. With those, the address is a string, not a tuple.

@giampaolo
Copy link
Owner

I think I'm gonna reject this for consistency with socket.getsockname() and socket.getpeername() which both return a raw tuple.

@guettli
Copy link
Contributor Author

guettli commented Jun 16, 2017

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 ...

@guettli
Copy link
Contributor Author

guettli commented Jun 22, 2017

.... 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.

@giampaolo
Copy link
Owner

OK this is now fixed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants