[Python-Dev] PEP 3144 review. (original) (raw)
Antoine Pitrou solipsis at pitrou.net
Tue Sep 15 21:58:31 CEST 2009
- Previous message: [Python-Dev] PEP 3144 review.
- Next message: [Python-Dev] PEP 3144 review.
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
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 'networkip' or 'networkaddress' 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'?
- Previous message: [Python-Dev] PEP 3144 review.
- Next message: [Python-Dev] PEP 3144 review.
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]