[Python-Dev] PEP 3144 review.

Dj Gilcrease digitalxero at gmail.com
Mon Sep 28 15:12:57 CEST 2009


On Mon, Sep 28, 2009 at 5:34 AM, R. David Murray <rdmurray at bitdance.com> wrote:
> The fundamental divide here is between two behaviors.
>
> ipaddr:
>
>    >>> x = IPv4Network('192.168.1.1/24')
>    >>> y = IPv4Network('192.168.1.0/24')
>    >>> x == y
>    False
>    >>> x.ip
>    IPv4Address('192.168.1.1')
>
> desired:
>
>    >>> x = IPv4Network('192.168.1.1/24')
>    >>> y = IPv4Network('192.168.1.0/24')
>    >>> x == y
>    True
>    >>> x.ip
>    Traceback (most recent call last):
>      File "<stdin>", line 1, in <module>
>    AttributeError: 'IPv4Network' object has no attribute 'ip'


I submitted a patch to ipadrdr http://codereview.appspot.com/124057
which would do
    >>> x = IPv4Network('192.168.1.1/24')
    >>> y = IPv4Network('192.168.1.0/24')
    >>> x == y
    True
    >>> x.ip
     IPv4Address('192.168.1.1')


More information about the Python-Dev mailing list