Skip to content

Commit 7dacbec

Browse files
committed
gh-156680 - Update IPv4Network and IPv6Network docstring.
Mention that the address argument can be a two-tuple representing address description and a netmask.
1 parent 092c896 commit 7dacbec

1 file changed

Lines changed: 13 additions & 0 deletions

File tree

Lib/ipaddress.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1567,6 +1567,13 @@ def __init__(self, address, strict=True):
15671567
IPv4Interface(int(IPv4Interface('192.0.2.1'))) ==
15681568
IPv4Interface('192.0.2.1')
15691569
1570+
The address can also be a two-tuple of an address description
1571+
and a netmask, where the address description is either a
1572+
string, a 32-bits integer, a 4-bytes packed integer, or an
1573+
existing IPv4Address object; and the netmask is either an
1574+
integer representing the prefix length (e.g. 24) or a string
1575+
representing the prefix mask (e.g. '255.255.255.0').
1576+
15701577
Raises:
15711578
AddressValueError: If ipaddress isn't a valid IPv4 address.
15721579
NetmaskValueError: If the netmask isn't valid for
@@ -2358,6 +2365,12 @@ def __init__(self, address, strict=True):
23582365
IPv6Network(int(IPv6Network('2001:db8::'))) ==
23592366
IPv6Network('2001:db8::')
23602367
2368+
The address can also be a two-tuple of an address description
2369+
and a netmask, where the address description is either a
2370+
string, a 128-bits integer, a 16-bytes packed integer, or an
2371+
existing IPv6Address object; and the netmask is an integer
2372+
representing the prefix length.
2373+
23612374
strict: A boolean. If true, ensure that we have been passed
23622375
A true network address, eg, 2001:db8::1000/124 and not an
23632376
IP address on a network, eg, 2001:db8::1/124.

0 commit comments

Comments
 (0)