finding _collections in python source

前端 未结 3 1560
终归单人心
终归单人心 2020-12-19 03:45

I wanted to have a look at the python deque class. When I checked the source code , I found the following at line 10

 from _collections import deque, default         


        
相关标签:
3条回答
  • 2020-12-19 04:21

    These days the CPython source code (including built-in modules) is hosted on Github, so you can find the collections module source code here.

    For the collections.abc module, see here.

    0 讨论(0)
  • 2020-12-19 04:25

    _collections is a private implementation of a class according to this answer: "Private" (implementation) class in Python.

    Being private, I don't think that you will be able to access its Python source but you can check out the C implementation here.

    0 讨论(0)
  • 2020-12-19 04:29

    _collections is builtin extension module.

    You can find source for _collection module here.

    Setup.dist contains mapping between builtin extension module name to source file.

    0 讨论(0)
提交回复
热议问题