Message290469
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. |
|
Date |
User |
Action |
Args |
2017-03-25 09:03:48 | eric.smith | set | recipients:
+ eric.smith, pmoody, Ilya.Kulakov, louielu |
2017-03-25 09:03:48 | eric.smith | set | messageid: <1490432628.88.0.15191287725.issue29890@psf.upfronthosting.co.za> |
2017-03-25 09:03:48 | eric.smith | link | issue29890 messages |
2017-03-25 09:03:48 | eric.smith | create | |
|