[Python-Dev] PEP 3144 review. (original) (raw)

Antoine Pitrou solipsis at pitrou.net
Tue Sep 15 20:43:59 CEST 2009


R. David Murray <rdmurray bitdance.com> writes:

x = IPv4AddressWithMask('192.168.1.1/24') x.network == IPv4Network('192.168.1.0/24') x.network[1] == x

I don't think we need an IPAddressWithMask which would just complicate the API without any obvious benefit. We just need a factory function which returns a tuple after parsing:

>>> addr, net = parse_address_with_mask('192.168.1.1/24')
>>> addr == IPv4Address('192.168.1.1')
True
>>> net == IPv4Network('192.168.1.0/24')
True

Regards

Antoine.



More information about the Python-Dev mailing list