Message 78680 - Python tracker (original) (raw)
hm, all addresses have a subnet, even if its an implied /32, so specifying a network as ("1.1.1.0", "1.1.1.255") seems a lot more off-putting than "1.1.1.0/24". You're also much more likely to see the latter in network devices.
I'm not sure which API in netaddr you're referring to. If you want to construct that /24 with netaddr, then I would use netaddr.address.CIDR("1.1.1.0/24"). Offhand, I can't find an API which accepts two endpoints of a range to construct a network in netaddr. When I wrote about having separate types for individual addresses vs ranges of addresses in my previous comment, I had IP and CIDR respectively in mind, as opposed to ipaddr-py's single IPv4 class which can represent either.