Where is the _ socket module in Python?

at the beginning of the socket.py file of the standard library, there is a description like this:

-sharp Wrapper module for _socket, providing some additional facilities
-sharp implemented in Python.

I didn"t find the information about _ socket mentioned here in the standard library. What is it?

May.08,2021

check the documentation for both modules.
_ socket is in the link library. That is to say, this is not implemented in python, it is a C implementation of socket operation, and this is a very low-level operation. socket.py is a module that encapsulates the module implemented in C with py code for human use.
the location of _ socket is different in different systems, so you can look at it concretely, and then if you want to see the source code, you have to look directly at the uncompiled python source code before you can see the code of _ socket.

In [5]: socket?
Type:        module
String form: <module 'socket' from '/usr/lib64/python2.7/socket.pyc'>
File:        /usr/lib64/python2.7/socket.py
Docstring:
This module provides socket operations and some related functions.
On Unix, it supports IP (Internet Protocol) and Unix domain sockets.
On other systems, it only supports IP. Functions specific for a
socket are available as methods of the socket object.
Menu