Finding the source code for built-in Python functions?

前端 未结 8 1658
一向
一向 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 03:10

    I had to dig a little to find the source of the following Built-in Functions as the search would yield thousands of results. (Good luck searching for any of those to find where it's source is)

    Anyway, all those functions are defined in bltinmodule.c Functions start with builtin_{functionname}

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

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

提交回复
热议问题