[Python-Dev] Request for comments: [issue22941] IPv4Interface arithmetic changes subnet mask

Stephen J. Turnbull stephen at xemacs.org
Sun Mar 15 06:22:06 CET 2015


Eric V. Smith writes:

 > Personally, I can't imaging wanting that behavior. I can't say I've ever
 > needed additional at all with an IP address, but if I did, it would only
 > be to stay within the host portion. To wrap around seems odd.

It's worse than odd.  I've occasionally had use for iterating
something like a "ping" over a network, and if I make an off-by-one
error "boom" I hit the network address or (probably worse) the
broadcast address.

The ipaddress module appears to have an __iter__ method on
IPv4Network that dtrts.  I don't see a real need for an addition
operator given that.


More information about the Python-Dev mailing list