Does anyone know good bo开发者_C百科oks that discuss the underlying architectures, in-depth analysis of CPython implementation. Something like
- how list / tuple / dict implemented (and performance comparison...)
- OOP discussion in Python context
Sorry if it sounds like a silly question :(
You should absolutely, at some point in your Python career, read every word of the Python Data Model and the Python Execution Model. While not CPython-specific, these articles are essential to understanding Python deeply.
Python features are described and discussed in Python Enhancement Proposals ("PEPs") These describe the implementation, also PEPs often contain working Python Code to help explain the algorithm though the final implementation may be in C. If you need more details than can be gotten from the PEPs then you should take a look at the source code.
Note: PEPs are written from the perspective of what ever enhancement is being proposed rather than an overall description of the implementation. So for example there might a PEP for Dict-Comprehensions but not for Dicts as a whole. For a top down view of Python internals the source code is the place to go.
Beautiful Code book has a nice explanation about how dicts are implemented.
This doesn't directly answer your question but it's useful to know nevertheless:
The source code of CPython is well-written and well-documented, and there are some PEPs that shed light on parts of the implementation. You should really try just reading it.
精彩评论