You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi! With python 3.x (and MAYBE 2.7?), ipaddress is now a standard library.
It'd be great if netaddr could parse those objects into native objects(A) and have a native library object attribute(B), e.g.:
#!/usr/bin/env python3importipaddressimportnetaddrip4=ipaddress.ip_address('192.0.2.1') # instance of ipaddress.IPv4Addressip6=ipaddress.ip_address('2001:DB8::1') # instance of ipaddress.IPv6Addressnet4=ipaddress.ip_network('192.0.2.0/24') # instance of ipaddress.IPv4Networknet6=ipaddress.ip_network('2001:DB8::/32') # instance of ipaddress.IPv6Network# "A"n_ip4=netaddr.IPAddress(ip4) # instance of netaddr.ip.IPAddress using aboven_ip6=netaddr.IPAddress(ip6) # instance of netaddr.ip.IPAddress using aboven_net4=netaddr.IPNetwork(net4) # instance of netaddr.ip.IPNetwork using aboven_net6=netaddr.IPNetwork(net6) # instance of netaddr.ip.IPNetwork using above# "B"isinstance(n_ip4.ipaddress, ipaddress.IPv4Address) # This attribute would exist and this test would be True.
Thoughts?
The text was updated successfully, but these errors were encountered:
A should be fairly easy; the str() conversion for ipaddress.IPv4Address/ipaddress.IPv6Address is the string representation that netaddr.IPAddress() accepts.
LIkewise, for ipaddress.IPv4Network/ipaddress.IPv6Networkstr() conversions, it's in the standard network/prefix format (e.g. 192.0.2.0/24).
Since ipaddress is in the standard library, how about removing the impl duplicating the impl there and just reuse the impl that is already in the standard library?
I'm happy to accept a pull request that keeps the current interface but reuses the standard library implementation (Python 3.6+ is fine as we're about to drop 2.7 and 3.5 compatibility anyway).
Hi! With python 3.x (and MAYBE 2.7?),
ipaddress
is now a standard library.It'd be great if netaddr could parse those objects into native objects(
A
) and have a native library object attribute(B
), e.g.:Thoughts?
The text was updated successfully, but these errors were encountered: