Where is the source code of the Python3 commands located?

Asked

Viewed 296 times

1

Where is the source code for the Python3 commands? I want to see the source code for the commands as len(), count(), find(), etc etc. I use Linux Mint, I’ve looked and looked, but I don’t think...

Anyone who can help, thank you!

1 answer

2


The source code for Cpython 3 is in that repository. You probably can’t find it because you have only compiled Python installed, which does not include the source code (Cpython, the main interpreter, is written in C).

Pros built-in objects, functions like len are defined in the code in C. For example, use Ctrl + F to look for "list_length" in the source of a list.

If you have a Python class that defines the function __len__, then this will be the function used by Python to discover the size of the object, but this is not the case for built-ins written in C.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.