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.
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.
Activity
srittau commented on May 28, 2021
The documentation of socket.SocketType (https://docs.python.org/3/library/socket.html?highlight=sockettype#socket.SocketType) is misleading. It states:
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.
JelleZijlstra commented on May 29, 2021
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.
pythongh-89554: Document socket.SocketType as a class and fix its des…
pythongh-89554: Document socket.SocketType as a class and fix its des…
pythongh-89554: Document socket.SocketType as a class
gh-89554: Document socket.SocketType as a class (#150683)
[3.15] gh-89554: Document socket.SocketType as a class (GH-150683) (#…
[3.14] gh-89554: Document socket.SocketType as a class (#150683) (#15…
[3.13][3.14] gh-89554: Document socket.SocketType as a class (#150683) (
pythongh-89554: Document socket.SocketType as a class (python#150683)