Title: ipaddress incompatibility with ipaddr: __contains__ between networks
Type: behavior Stage: needs patch
Components: Library (Lib) Versions: Python 3.6
Status: open Resolution:
Dependencies: Superseder:
Assigned To: Nosy List: berker.peksag, lukasz.langa, ncoghlan, pmoody, serhiy.storchaka
Priority: normal Keywords:

Created on 2016-07-26 17:34 by lukasz.langa, last changed 2016-07-26 19:00 by berker.peksag.

Messages (3)
msg271399 - (view) Author: Ɓukasz Langa (lukasz.langa) * (Python committer) Date: 2016-07-26 17:34
ipaddr historically let users compare if one network is within another network:

ipaddress specifically prohibits this comparison:

What is the reason behind this change? I propose we restore this functionality for 3.6. It's a behavior change but arguably backwards compatible in the sense that between 3.3 and 3.5 this __contains__ comparison always returns False. It's also more on par with what ipaddr did in the past. Thoughts?
msg271401 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2016-07-26 17:55
This issue looks as a duplicate of issue20825.

I think that if consider a network as a set of addresses, the operation "address in network" has the same meaning as for sets, but the operation "network in network" doesn't make a sense. Instead you should use the same operation as for testing a subset of a set: "network <= network". But this operation is ambiguous, because "<=" usually is ordering operation.
msg271408 - (view) Author: Berker Peksag (berker.peksag) * (Python committer) Date: 2016-07-26 19:00
See also issue 25431.
Date User Action Args
2016-07-26 19:00:54berker.peksagsetmessages: + msg271408
2016-07-26 17:55:39serhiy.storchakasetnosy: + serhiy.storchaka
messages: + msg271401
2016-07-26 17:42:56pmoodysetassignee: pmoody ->
2016-07-26 17:34:35lukasz.langacreate