Finding the source code for built-in Python functions?

前端 未结 8 1868
一向
一向 2020-11-22 02:40

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

8条回答
  •  半阙折子戏
    2020-11-22 02:46

    The iPython shell makes this easy: function? will give you the documentation. function?? shows also the code. BUT this only works for pure python functions.

    Then you can always download the source code for the (c)Python.

    If you're interested in pythonic implementations of core functionality have a look at PyPy source.

提交回复
热议问题