Skip to content

Commit 82e7f23

Browse files
committed
Issue #5626: Remove misleading comment from socket.gethostname() documentation
A machine can have more than one IP addresses so socket.gethostbyname(socket.gethostname()) probably won't return the correct one.
2 parents a9e3dcf + 388083b commit 82e7f23

File tree

1 file changed

+0
-5
lines changed

1 file changed

+0
-5
lines changed

Doc/library/socket.rst

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -568,11 +568,6 @@ The :mod:`socket` module also offers various network-related services:
568568
Return a string containing the hostname of the machine where the Python
569569
interpreter is currently executing.
570570

571-
If you want to know the current machine's IP address, you may want to use
572-
``gethostbyname(gethostname())``. This operation assumes that there is a
573-
valid address-to-host mapping for the host, and the assumption does not
574-
always hold.
575-
576571
Note: :func:`gethostname` doesn't always return the fully qualified domain
577572
name; use :func:`getfqdn` for that.
578573

0 commit comments

Comments
 (0)