Antoine Pitrou writes:

 > > An IPv4Address with 'network' and 'mask' attributes that could be
 > > None would also not complicate the API, IMO, and would handle both
 > > of these use cases.
 > 
 > But it would be confusing and conceptually bizarre, because an address (in
 > usually accepted terminology) doesn't have a network and a mask.

It doesn't need a mask attribute because the network knows that.

OTOH, it would be useful for an address to be able to cache the
network it is a member of, because the object that represents a
particular network should be unique.  That means a lookup in a table,
and possibly constructing a new IPv4Network object to represent the
anwser if false, if you are given a netmask and asked to deduce *the*
network.  And addresses do, implicitly, have a network.  Otherwise
the're useless!<0.5 wink>

_______________________________________________
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