Finding the source code for built-in Python functions?
问题 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 or enumerate etc...? 回答1: Since Python is open source you can read the source code. To find out what file a particular module or function is implemented in you can usually print the __file__ attribute. Alternatively, you may use the inspect module, see the section Retrieving Source Code in the documentation of inspect . For built-in