[Python-Dev] PEP 3144 review.

Antoine Pitrou solipsis at pitrou.net
Tue Sep 15 21:58:31 CEST 2009


Le mardi 15 septembre 2009 à 15:48 -0400, R. David Murray a écrit :
> 
> It's useful functionality is parsing/validating an address+mask, rendering
> as address+mask, and being able to get the associated IP and network objects
> from it.  It's a small class, but useful, IMO.

If it's only about parsing and validating, then a tuple works just fine.
Getting the associated IP objects is obtained from iterating over the
network.
Getting the associated network objects I don't understand. There is a
single network, not a bunch of them.

> However, I do not think
> that the proposed API should accept, eg, IPv4Network('192.168.1.1/24')
> as valid.  That's just too confusing and error prone.

Indeed, it should throw some kind of ValueError instead.

> Oh, and if people don't like 'zero' as the name for the IPv4Address
> at the beginning of the network IP range, how about 'network_ip' or
> 'network_address' instead of just network, to make it clearer that it
> is an address?

How about something more explicit about how it's obtained, like
'lower_bound'?





More information about the Python-Dev mailing list