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: SocketType documentation misleading
Type: Stage:
Components: Documentation Versions:
process
Status: open Resolution:
Dependencies: Superseder:
Assigned To: docs@python Nosy List: JelleZijlstra, docs@python, srittau
Priority: normal Keywords:

Created on 2021-05-28 15:21 by srittau, last changed 2022-04-11 14:59 by admin.

Messages (2)
msg394665 - (view) Author: Sebastian Rittau (srittau) * Date: 2021-05-28 15:21
The documentation of socket.SocketType (https://docs.python.org/3/library/socket.html?highlight=sockettype#socket.SocketType) is misleading. It states:

    This is a Python type object that represents the socket object type. It is the same as type(socket(...)).

This is untrue. socket.SocketType is in reality re-exported from _socket, where it is an alias for class _socket.socket, a super type of class socket.socket. I think that either the documentation should be fixed, or SocketType should be moved to socket and made an alias of socket.socket.
msg394743 - (view) Author: Jelle Zijlstra (JelleZijlstra) * (Python committer) Date: 2021-05-29 23:00
I propose to deprecate socket.SocketType. There's no reason to publicly expose _socket.socket separately from socket.socket, the only type that moat users should care about.

SocketType isn't needed for type checking; socket.socket is itself a class and can be used in type annotations.
History
Date User Action Args
2022-04-11 14:59:46adminsetgithub: 88427
2021-05-29 23:00:46JelleZijlstrasetnosy: + JelleZijlstra
messages: + msg394743
2021-05-28 15:21:42srittaucreate