Hacker News new | ask | show | jobs
by signet 3294 days ago
My personal favorite is native support for IP addresses, introduced in python 3.3[0]. Makes IP math and address validation so much easier.

[0] https://docs.python.org/3/library/ipaddress.html

3 comments

To be fair, you can grab the original. https://pypi.python.org/pypi/ipaddress
Anybody who likes that will like subnettree, too, which offers a C-based Patricia tree for IP addresses. In the past, I've gotten a lot of mileage out of this library:

https://pypi.python.org/pypi/pysubnettree

Last time I played with it, it didn't like Python 3 or ipaddress, though. I see a recent upload, so maybe they addressed that.

> address validation

just try: socket.inet_aton

That doesn't seem to support IPv6 at all. And doesn't let you do much with a parsed address either.