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.

classification
Title: socket.socket should be a class instead of a function
Type: behavior Stage: resolved
Components: Documentation Versions: Python 3.11, Python 3.10, Python 3.9
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: docs@python Nosy List: arhadthedev, asvetlov, docs@python, miss-islington, pitrou, terry.reedy, xuhdev
Priority: normal Keywords: patch

Created on 2021-11-09 19:55 by arhadthedev, last changed 2022-04-11 14:59 by admin. This issue is now closed.

Pull Requests
URL Status Linked Edit
PR 23960 merged arhadthedev, 2021-11-09 19:55
PR 29542 merged miss-islington, 2021-11-13 06:02
PR 29543 merged miss-islington, 2021-11-13 06:02
PR 29544 closed miss-islington, 2021-11-13 06:02
Messages (5)
msg406045 - (view) Author: Oleg Iarygin (arhadthedev) * Date: 2021-11-09 19:55
Found a twice stale bpo-less but useful pull request 23960, so publish it here:

> Currently socket.socket is documented as a function, but it is really
a class (and thus has function-like usage to construct an object). This
correction would ensure that Python projects that are interlinking
Python's documentation can properly locate socket.socket as a type.
msg406246 - (view) Author: Terry J. Reedy (terry.reedy) * (Python committer) Date: 2021-11-12 22:14
Filter, map, and zip are documented as functions to allow other interpreters to implement them as such, with generator functions.  That does not apply here, but maybe there is another reason for socket being called a 'function.

Antoine, git blame credits you with socket.rst, line 565
.. function:: socket(family=AF_INET, type=SOCK_STREAM, proto=0, fileno=None)
https://docs.python.org/3/library/socket.html#socket.socket

PR-23960 changes 'function' to 'class'.  What do you think?
msg406268 - (view) Author: Andrew Svetlov (asvetlov) * (Python committer) Date: 2021-11-13 06:02
New changeset 4c792f39e688b11c7c19e411ed4f76a7baa44638 by Hong Xu in branch 'main':
bpo-45772: socket.socket should be a class instead of a function (GH-23960)
https://github.com/python/cpython/commit/4c792f39e688b11c7c19e411ed4f76a7baa44638
msg406269 - (view) Author: miss-islington (miss-islington) Date: 2021-11-13 06:23
New changeset 3f15792d60011639d9b170d8a76c6db7f6e83665 by Miss Islington (bot) in branch '3.10':
[3.10] bpo-45772: socket.socket should be a class instead of a function (GH-23960) (GH-29542)
https://github.com/python/cpython/commit/3f15792d60011639d9b170d8a76c6db7f6e83665
msg406270 - (view) Author: miss-islington (miss-islington) Date: 2021-11-13 06:29
New changeset b952f60213c60f89a50e4538783a18ced64ca91f by Miss Islington (bot) in branch '3.9':
[3.9] bpo-45772: socket.socket should be a class instead of a function (GH-23960) (GH-29543)
https://github.com/python/cpython/commit/b952f60213c60f89a50e4538783a18ced64ca91f
History
Date User Action Args
2022-04-11 14:59:52adminsetgithub: 89930
2021-11-13 06:29:08miss-islingtonsetmessages: + msg406270
2021-11-13 06:23:31miss-islingtonsetmessages: + msg406269
2021-11-13 06:20:12arhadthedevsetstatus: open -> closed
resolution: fixed
stage: patch review -> resolved
2021-11-13 06:02:36miss-islingtonsetpull_requests: + pull_request27792
2021-11-13 06:02:31miss-islingtonsetpull_requests: + pull_request27791
2021-11-13 06:02:26miss-islingtonsetkeywords: + patch
nosy: + miss-islington
pull_requests: + pull_request27790
2021-11-13 06:02:12asvetlovsetnosy: + asvetlov
messages: + msg406268
2021-11-12 22:14:07terry.reedysetversions: - Python 3.6, Python 3.7, Python 3.8
nosy: + terry.reedy, pitrou

messages: + msg406246

type: behavior
stage: patch review
2021-11-09 19:55:56arhadthedevcreate