VS Code go to source for Python3 built-ins

Viewed 94

How can I see the source code of Python builtin functions in Visual Studio Code? For example, how do I see the source code for print() when I control click on it?

1 Answers

VS Code presents you with skeleton methods that show just the function signatures. Python's built-in functions for CPython are written in C and compiled into bytecode to be interpreted during execution time.

If you'd like to view the source code for some built-in methods, you'll have to check the source code of your Python interpreter.

See print implementation for CPython, Python default interpreter: https://github.com/python/cpython/blob/main/Python/bltinmodule.c#L1947

Built-in functions source: https://github.com/python/cpython/blob/master/Python/bltinmodule.c

Built-in types: https://github.com/python/cpython/tree/master/Objects

Related