Message231670
Addition and subtraction of integers are documented for ipaddress.IPv4Address and ipaddress.IPv6Address, but also work for IPv4Interface and IPv6Interface (though the only documentation of this is a brief mention that the Interface classes inherit from the respective Address classes). That's good.
The problem is that adding/subtracting an integer to an Interface object changes the subnet mask (to max_prefixlen), something which is 1) not documented and 2) not the least surprising result.
>>> import ipaddress
>>> ipaddress.IPv4Interface('10.0.0.1/8') + 1
IPv4Interface('10.0.0.2/32')
>>> ipaddress.IPv6Interface('fd00::1/64') + 1
IPv6Interface('fd00::2/128')
Changing this breaks backwards compatibility; though since the ipaddress module was provisional until recently and the behavior is undocumented, I hope it's not too late to change. |
|
Date |
User |
Action |
Args |
2014-11-25 16:41:57 | kwi.dk | set | recipients:
+ kwi.dk |
2014-11-25 16:41:57 | kwi.dk | set | messageid: <1416933717.58.0.234544639586.issue22941@psf.upfronthosting.co.za> |
2014-11-25 16:41:57 | kwi.dk | link | issue22941 messages |
2014-11-25 16:41:57 | kwi.dk | create | |
|