@@ -1333,18 +1333,38 @@ def is_reserved(self):
13331333 @property
13341334 @functools .lru_cache ()
13351335 def is_private (self ):
1336- """Test if this address is allocated for private networks.
1336+ """``True`` if the address is defined as not globally reachable by
1337+ iana-ipv4-special-registry_ (for IPv4) or iana-ipv6-special-registry_
1338+ (for IPv6) with the following exceptions:
13371339
1338- Returns:
1339- A boolean, True if the address is reserved per
1340- iana-ipv4-special-registry.
1340+ * ``is_private`` is ``False`` for ``100.64.0.0/10``
1341+ * For IPv4-mapped IPv6-addresses the ``is_private`` value is determined by the
1342+ semantics of the underlying IPv4 addresses and the following condition holds
1343+ (see :attr:`IPv6Address.ipv4_mapped`)::
1344+
1345+ address.is_private == address.ipv4_mapped.is_private
13411346
1347+ ``is_private`` has value opposite to :attr:`is_global`, except for the ``100.64.0.0/10``
1348+ IPv4 range where they are both ``False``.
13421349 """
13431350 return any (self in net for net in self ._constants ._private_networks )
13441351
13451352 @property
13461353 @functools .lru_cache ()
13471354 def is_global (self ):
1355+ """``True`` if the address is defined as globally reachable by
1356+ iana-ipv4-special-registry_ (for IPv4) or iana-ipv6-special-registry_
1357+ (for IPv6) with the following exception:
1358+
1359+ For IPv4-mapped IPv6-addresses the ``is_private`` value is determined by the
1360+ semantics of the underlying IPv4 addresses and the following condition holds
1361+ (see :attr:`IPv6Address.ipv4_mapped`)::
1362+
1363+ address.is_global == address.ipv4_mapped.is_global
1364+
1365+ ``is_global`` has value opposite to :attr:`is_private`, except for the ``100.64.0.0/10``
1366+ IPv4 range where they are both ``False``.
1367+ """
13481368 return self not in self ._constants ._public_network and not self .is_private
13491369
13501370 @property
@@ -2007,13 +2027,19 @@ def is_site_local(self):
20072027 @property
20082028 @functools .lru_cache ()
20092029 def is_private (self ):
2010- """Test if this address is allocated for private networks.
2030+ """``True`` if the address is defined as not globally reachable by
2031+ iana-ipv4-special-registry_ (for IPv4) or iana-ipv6-special-registry_
2032+ (for IPv6) with the following exceptions:
20112033
2012- Returns:
2013- A boolean, True if the address is reserved per
2014- iana-ipv6-special-registry, or is ipv4_mapped and is
2015- reserved in the iana-ipv4-special-registry.
2034+ * ``is_private`` is ``False`` for ``100.64.0.0/10``
2035+ * For IPv4-mapped IPv6-addresses the ``is_private`` value is determined by the
2036+ semantics of the underlying IPv4 addresses and the following condition holds
2037+ (see :attr:`IPv6Address.ipv4_mapped`)::
2038+
2039+ address.is_private == address.ipv4_mapped.is_private
20162040
2041+ ``is_private`` has value opposite to :attr:`is_global`, except for the ``100.64.0.0/10``
2042+ IPv4 range where they are both ``False``.
20172043 """
20182044 ipv4_mapped = self .ipv4_mapped
20192045 if ipv4_mapped is not None :
@@ -2022,12 +2048,18 @@ def is_private(self):
20222048
20232049 @property
20242050 def is_global (self ):
2025- """Test if this address is allocated for public networks.
2051+ """``True`` if the address is defined as globally reachable by
2052+ iana-ipv4-special-registry_ (for IPv4) or iana-ipv6-special-registry_
2053+ (for IPv6) with the following exception:
20262054
2027- Returns:
2028- A boolean, true if the address is not reserved per
2029- iana-ipv6-special-registry.
2055+ For IPv4-mapped IPv6-addresses the ``is_private`` value is determined by the
2056+ semantics of the underlying IPv4 addresses and the following condition holds
2057+ (see :attr:`IPv6Address.ipv4_mapped`)::
2058+
2059+ address.is_global == address.ipv4_mapped.is_global
20302060
2061+ ``is_global`` has value opposite to :attr:`is_private`, except for the ``100.64.0.0/10``
2062+ IPv4 range where they are both ``False``.
20312063 """
20322064 return not self .is_private
20332065
0 commit comments