[Python-Dev] PEP 3144: IP Address Manipulation Library for the Python Standard Library

Guido van Rossum guido at python.org
Sun Sep 27 04:25:32 CEST 2009


I realize I'm late to this party, but this is just a naming issue, right?

For any network, there are two special addresses, one with the last
bits all zeros, one with the last bits all ones. We can call them A
and B, or network and broadcast, or zeros and ones, or whatever we
care. But their definitions are two well-defined functions for all
networks (assuming a network is defined as an IP address and a number
of bits), even if in an extreme case the functions return the same
value.

What is actually configured on a particular host to be the broadcast
address is a separate issue, even if *by convention* in most cases it
is given by one of the above functions -- the network object doesn't
care, the configuration object is something else (and outside the
scope of this PEP).

IMO "real life examples" don't matter for the definitions of the
functions, and I would personally be happy to name them network and
broadcast, since I know their definitions and their typical uses and
these match pretty closely. The expectation should be clearly set that
these are pure functions though and do not imply knowledge of the
configuration of any given host.

--Guido

On Sat, Sep 26, 2009 at 11:19 AM, "Martin v. Löwis" <martin at v.loewis.de> wrote:
>>>> I think using .network and .broadcast are pretty well understood to be the
>>>> [0] and [-1] of the network address block. I don't think we want to start
>>>> creating new terms or access patterns here.
>>>>
>>>> +1 on leaving .network and .broadcast as-is (including returning a
>>>> IPvXAddress object).
>>>>
>>> -1.  I think 'network.number' or 'network.zero' is a lot clearer than
>>> 'network.network'.  Maybe '.broadcast' would be okay, as long as it *can* be
>>> adjusted for those unusual, or maybe even only hypothetical, networks where
>>> it is not the [-1].
>> Real life example: network with a /31 mask.
>> There are only two hosts: 0 and 1
>> first host configures the other's host as broadcast address and vice versa.
>> NOTE - broadcasts are different here!
>
> This is RFC 3021. IIUC, it does not support directed broadcast; only
> link-local broadcast can be used on that link.
>
> So ISTM that .broadcast should raise an exception on a /31 network. Any
> installation that configures the partner as the broadcast address is
> broken (somebody correct me if I'm wrong).
>
>> Another real life examples include /32 networks on PPP. Just a point-to-point.
>> No need for broadcasts and networks, a host just have one IP address and
>> send all traffic via point-to-point link, no addressing is required there.
>> This is a working dialup configuration, it works for me, it works for you, probably.
>> It is not weird, it is common, it is used for PPPoE, for ADSL, for dialup.
>
> So where is that defined?
>
> Regards,
> Martin
> _______________________________________________
> Python-Dev mailing list
> Python-Dev at python.org
> http://mail.python.org/mailman/listinfo/python-dev
> Unsubscribe: http://mail.python.org/mailman/options/python-dev/guido%40python.org
>



-- 
--Guido van Rossum (home page: http://www.python.org/~guido/)


More information about the Python-Dev mailing list