summaryrefslogtreecommitdiffstats
path: root/Doc
diff options
context:
space:
mode:
authorCheryl Sabella <cheryl.sabella@gmail.com>2017-10-22 21:39:49 (GMT)
committerAntoine Pitrou <pitrou@free.fr>2017-10-22 21:39:49 (GMT)
commit91dc64ba3f51100540b2ab6c6cd72c3bb18a6d49 (patch)
tree011cf75c270c0a1ba07a023caa0c2f1a547e0d86 /Doc
parent04e36af9b88cd5e80fc818e51d46f07252a2ff3f (diff)
downloadcpython-91dc64ba3f51100540b2ab6c6cd72c3bb18a6d49.zip
cpython-91dc64ba3f51100540b2ab6c6cd72c3bb18a6d49.tar.gz
cpython-91dc64ba3f51100540b2ab6c6cd72c3bb18a6d49.tar.bz2
bpo-20825: Containment test for ip_network in ip_network.
Diffstat (limited to 'Doc')
-rw-r--r--Doc/library/ipaddress.rst24
1 files changed, 24 insertions, 0 deletions
diff --git a/Doc/library/ipaddress.rst b/Doc/library/ipaddress.rst
index 36c6859..75c9107 100644
--- a/Doc/library/ipaddress.rst
+++ b/Doc/library/ipaddress.rst
@@ -543,6 +543,28 @@ so to avoid duplication they are only documented for :class:`IPv4Network`.
>>> ip_network('192.0.2.0/24').supernet(new_prefix=20)
IPv4Network('192.0.0.0/20')
+ .. method:: subnet_of(other)
+
+ Returns *True* if this network is a subnet of *other*.
+
+ >>> a = ip_network('192.168.1.0/24')
+ >>> b = ip_network('192.168.1.128/30')
+ >>> b.subnet_of(a)
+ True
+
+ .. versionadded:: 3.7
+
+ .. method:: supernet_of(other)
+
+ Returns *True* if this network is a supernet of *other*.
+
+ >>> a = ip_network('192.168.1.0/24')
+ >>> b = ip_network('192.168.1.128/30')
+ >>> a.supernet_of(b)
+ True
+
+ .. versionadded:: 3.7
+
.. method:: compare_networks(other)
Compare this network to *other*. In this comparison only the network
@@ -621,6 +643,8 @@ so to avoid duplication they are only documented for :class:`IPv4Network`.
.. method:: address_exclude(network)
.. method:: subnets(prefixlen_diff=1, new_prefix=None)
.. method:: supernet(prefixlen_diff=1, new_prefix=None)
+ .. method:: subnet_of(other)
+ .. method:: supernet_of(other)
.. method:: compare_networks(other)
Refer to the corresponding attribute documentation in