@@ -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
@@ -2049,13 +2069,19 @@ def is_site_local(self):
20492069 @property
20502070 @functools .lru_cache ()
20512071 def is_private (self ):
2052- """Test if this address is allocated for private networks.
2072+ """``True`` if the address is defined as not globally reachable by
2073+ iana-ipv4-special-registry_ (for IPv4) or iana-ipv6-special-registry_
2074+ (for IPv6) with the following exceptions:
20532075
2054- Returns:
2055- A boolean, True if the address is reserved per
2056- iana-ipv6-special-registry, or is ipv4_mapped and is
2057- reserved in the iana-ipv4-special-registry.
2076+ * ``is_private`` is ``False`` for ``100.64.0.0/10``
2077+ * For IPv4-mapped IPv6-addresses the ``is_private`` value is determined by the
2078+ semantics of the underlying IPv4 addresses and the following condition holds
2079+ (see :attr:`IPv6Address.ipv4_mapped`)::
2080+
2081+ address.is_private == address.ipv4_mapped.is_private
20582082
2083+ ``is_private`` has value opposite to :attr:`is_global`, except for the ``100.64.0.0/10``
2084+ IPv4 range where they are both ``False``.
20592085 """
20602086 ipv4_mapped = self .ipv4_mapped
20612087 if ipv4_mapped is not None :
@@ -2064,12 +2090,18 @@ def is_private(self):
20642090
20652091 @property
20662092 def is_global (self ):
2067- """Test if this address is allocated for public networks.
2093+ """``True`` if the address is defined as globally reachable by
2094+ iana-ipv4-special-registry_ (for IPv4) or iana-ipv6-special-registry_
2095+ (for IPv6) with the following exception:
20682096
2069- Returns:
2070- A boolean, true if the address is not reserved per
2071- iana-ipv6-special-registry.
2097+ For IPv4-mapped IPv6-addresses the ``is_private`` value is determined by the
2098+ semantics of the underlying IPv4 addresses and the following condition holds
2099+ (see :attr:`IPv6Address.ipv4_mapped`)::
2100+
2101+ address.is_global == address.ipv4_mapped.is_global
20722102
2103+ ``is_global`` has value opposite to :attr:`is_private`, except for the ``100.64.0.0/10``
2104+ IPv4 range where they are both ``False``.
20732105 """
20742106 return not self .is_private
20752107
0 commit comments