[Python-Dev] PEP 3144 review.

Steven D'Aprano steve at pearwood.info
Thu Sep 17 19:44:31 CEST 2009


On Thu, 17 Sep 2009 10:40:47 pm Nick Coghlan wrote:
> Antoine Pitrou wrote:
> > Peter Moody <peter <at> hda3.com> writes:
> >> the address with all of the hosts bits masked to zero is most
> >> commonly referred to as the network address. same as the address
> >> with all of the host bits set to one is called the broadcast
> >> address. calling it something like base_address or min_address
> >> will cause quite a bit more confusion.
> >
> > Quite a bit less IMO. I'm not a network specialist, but the
> > "network address"
>
> Nah, network address is perfectly explicit - it's what you get when
> you bitwise and any host within that network with the netmask.

[soapbox]
I really wish people would stop misusing the word "explicit" to mean 
(apparently) "I know how this is commonly defined".

To a non-specialist, "the network address" is ambiguous. There are many 
addresses in a network, and none of them are the entire network. It's 
like saying, given a list [2, 4, 8, 12], what's "the list item"?

If network specialists have a convention of calling hostadd&netmask "the 
network address", that's fine. It's jargon which seems illogical to me, 
but if it's useful and in common use, specialists will expect us to 
support it. But it's not explicit, it's a definition.


> Where it becomes confusing is that we have a property called
> "network" that returns an IPAddress object rather than an IPNetwork
> object.
>
> People that are network specialists would grasp that fairly easily,
> but we try to design standard library APIs so that they're novice
> friendly as well. And the above situation isn't novice friendly.

+1000 on this!


> To be honest, given the indexing behaviour, I'm -1 on the idea of
> giving the network address or broadcast address attribute names *at
> all*. Consider:
>
>   network_address = my_net[0]
>   broadcast_address = my_net[-1]
>
> The only way the network address could match the number of characters
> in the indexing method is if you just called it the network id (i.e.
> my_net.id). For the broadcast address, there is no name that even
> comes close to matching the indexing approach for brevity.

Is brevity so much more important than clarity and discoverability?




-- 
Steven D'Aprano


More information about the Python-Dev mailing list