Eric V. Smith added the comment:

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.

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue29890>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to