This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author eric.smith
Recipients Ilya.Kulakov, eric.smith, louielu, pmoody
Date 2017-03-25.09:03:48
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1490432628.88.0.15191287725.issue29890@psf.upfronthosting.co.za>
In-reply-to
Content
While an IPv4Interface may be a subclass of an IPv4Address, it definitely has more information attached to it: the netmask of the network it's on. So an interface (like a network) needs to allow additional parameters to specify the netmask.

It should be true that IPv4Interface is like IPv4Network, but it will allow arbitrary host bits. A IPv4Network in strict mode will have all zeros for the host bits, while a IPv4Network in non-strict mode will allow ones in the host bits (see Ilya's original example).

If you look at IPv4Interface.__init__, it actually does just that: creates an IPv4Network with strict=False, then extracts the network parts. I'm not exactly sure why it also has the int(address[1]) code there, too, since IPvv4Network deals with the address[1] part. I would think extracting _prefixlen from the network (as it does later in __init__ for the non-tuple case) would be good enough.
History
Date User Action Args
2017-03-25 09:03:48eric.smithsetrecipients: + eric.smith, pmoody, Ilya.Kulakov, louielu
2017-03-25 09:03:48eric.smithsetmessageid: <1490432628.88.0.15191287725.issue29890@psf.upfronthosting.co.za>
2017-03-25 09:03:48eric.smithlinkissue29890 messages
2017-03-25 09:03:48eric.smithcreate