Is there a way to see how built in functions work in python? I don\'t mean just how to use them, but also how were they built, what is the code behind sorted
As mentioned by @Jim, the file organization is described here. Reproduced for ease of discovery:
For Python modules, the typical layout is:
Lib/
.py Modules/_ .c (if there’s also a C accelerator module) Lib/test/test_ .py Doc/library/ .rst For extension-only modules, the typical layout is:
Modules/
module.c Lib/test/test_ .py Doc/library/ .rst For builtin types, the typical layout is:
Objects/
object.c Lib/test/test_ .py Doc/library/stdtypes.rst For builtin functions, the typical layout is:
Python/bltinmodule.c Lib/test/test_builtin.py Doc/library/functions.rst
Some exceptions:
builtin type int is at Objects/longobject.c builtin type str is at Objects/unicodeobject.c builtin module sys is at Python/sysmodule.c builtin module marshal is at Python/marshal.c Windows-only module winreg is at PC/winreg.c