On Tue, 15 Sep 2009 at 21:58, Antoine Pitrou wrote:
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.

The plural was for the two attributes.  I guess I just like accessing
things by name better than accessing them by indexes.  I suppose a
NamedTuple would work.  Anyway, like I said I'm not attached to that
class.

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.

Peter, what do you think?

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'?

Well, when this came up earlier 'first' and 'last' were suggested to
replace 'network' and 'broadcast', but that proposal didn't get much
traction, the argument being that in normal technical parlance
the first IP in the netblock is (apparently, this isn't my personal
experience(*)) called the network, and the broadcast is almost invariably
the last IP in the netblock (and that does agree with my experience).

--David

(*) in my experience it is called the "network number", which I gather
derives from the pre-CIDR days.  "network identifier" also appears
to be used.  In my experience "network" refers to something that has
a netmask, although the netmask may be implicit in its class in the
classful routing sense, or through other context.

Consider this article, for example:
http://compnetworking.about.com/od/workingwithipaddresses/l/aa042900a.htm
_______________________________________________
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com

Reply via email to