mirror of
https://github.com/python/cpython.git
synced 2025-09-28 11:15:17 +00:00
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.
This commit is contained in:
commit
5d69e6871a
1 changed files with 0 additions and 5 deletions
|
@ -568,11 +568,6 @@ The :mod:`socket` module also offers various network-related services:
|
||||||
Return a string containing the hostname of the machine where the Python
|
Return a string containing the hostname of the machine where the Python
|
||||||
interpreter is currently executing.
|
interpreter is currently executing.
|
||||||
|
|
||||||
If you want to know the current machine's IP address, you may want to use
|
|
||||||
``gethostbyname(gethostname())``. This operation assumes that there is a
|
|
||||||
valid address-to-host mapping for the host, and the assumption does not
|
|
||||||
always hold.
|
|
||||||
|
|
||||||
Note: :func:`gethostname` doesn't always return the fully qualified domain
|
Note: :func:`gethostname` doesn't always return the fully qualified domain
|
||||||
name; use :func:`getfqdn` for that.
|
name; use :func:`getfqdn` for that.
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue