This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Title: Explain that '' can be used to bind to all interfaces for the AF_INET address family in the docs
Type: enhancement Stage: resolved
Components: Documentation Versions: Python 3.8, Python 3.7, Python 3.6
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: docs@python Nosy List: John Hagen, ammar2, christian.heimes, docs@python, miss-islington, ned.deily
Priority: normal Keywords: easy, patch

Created on 2018-06-20 22:56 by John Hagen, last changed 2022-04-11 14:59 by admin. This issue is now closed.

Pull Requests
URL Status Linked Edit
PR 7877 merged python-dev, 2018-06-23 14:54
PR 8513 merged miss-islington, 2018-07-28 10:03
PR 8514 merged miss-islington, 2018-07-28 10:04
Messages (7)
msg320125 - (view) Author: John Hagen (John Hagen) * Date: 2018-06-20 22:56
The socket documentation ( does not list '' as a way to bind to all interfaces for the AF_INET/AF_INET6 address family.

This is answered on SO here: but it took me a while to find it. Ideally if this was mentioned in the docs, that would be great.
msg320159 - (view) Author: Ammar Askar (ammar2) * (Python committer) Date: 2018-06-21 11:01
It's kinda mentioned:

"For IPv4 addresses, two special forms are accepted instead of a host address: the empty string represents INADDR_ANY"

Though it could be more explicit on what means since binding to all interfaces is a common use case.
msg320165 - (view) Author: John Hagen (John Hagen) * Date: 2018-06-21 11:15

I see that now. Yeah it's further down in the docs and doesn't actually call out '' like is done for AF_CAN:

A tuple (interface, ) is used for the AF_CAN address family, where interface is a string representing a network interface name like 'can0'. The network interface name '' can be used to receive packets from all network interfaces of this family.

Ideally I think putting something in this section would be helpful:

A pair (host, port) is used for the AF_INET address family, where host is a string representing either a hostname in Internet domain notation like '' or an IPv4 address like '', and port is an integer.
msg320256 - (view) Author: Ned Deily (ned.deily) * (Python committer) Date: 2018-06-22 19:33
John, since you raised the issue, would you like to provide a doc PR?
msg322536 - (view) Author: Christian Heimes (christian.heimes) * (Python committer) Date: 2018-07-28 10:03
New changeset 95dfb9c3aefdc981d23af700b753a6c97159ccad by Christian Heimes (johnthagen) in branch 'master':
bpo-33921: Clarify how to bind to all interfaces using socket (GH-7877)
msg322548 - (view) Author: miss-islington (miss-islington) Date: 2018-07-28 12:27
New changeset 23355445625b8b41030dbda9decaf2f4aa7035a6 by Miss Islington (bot) in branch '3.7':
bpo-33921: Clarify how to bind to all interfaces using socket (GH-7877)
msg322549 - (view) Author: miss-islington (miss-islington) Date: 2018-07-28 12:27
New changeset 30f295b85ece2dc2b2b65018bd15090efa1de7dc by Miss Islington (bot) in branch '3.6':
bpo-33921: Clarify how to bind to all interfaces using socket (GH-7877)
Date User Action Args
2022-04-11 14:59:02adminsetgithub: 78102
2018-07-28 12:30:05steve.dowersetstatus: open -> closed
resolution: fixed
stage: patch review -> resolved
2018-07-28 12:27:30miss-islingtonsetmessages: + msg322549
2018-07-28 12:27:18miss-islingtonsetnosy: + miss-islington
messages: + msg322548
2018-07-28 10:04:32miss-islingtonsetpull_requests: + pull_request8031
2018-07-28 10:03:33miss-islingtonsetpull_requests: + pull_request8030
2018-07-28 10:03:26christian.heimessetnosy: + christian.heimes
messages: + msg322536
2018-06-23 14:54:23python-devsetkeywords: + patch
stage: needs patch -> patch review
pull_requests: + pull_request7484
2018-06-22 19:33:59ned.deilysetversions: - Python 3.5
nosy: + ned.deily

messages: + msg320256

keywords: + easy
stage: needs patch
2018-06-21 11:15:46John Hagensetmessages: + msg320165
2018-06-21 11:01:12ammar2setnosy: + ammar2
messages: + msg320159
2018-06-20 22:56:35John Hagencreate