CPython Internals: Your Guide to the Python 3

CPython Internals: Your Guide to the Python 3

 Are there certain parts of Python that just seem magic? Like how dictionaries are so much faster than looping over a list to find an item. How does a generator remember the state of the variables each time it yields a value, and why do you never have to allocate memory like other languages? It turns out, CPython, the most popular Python runtime is written in human-readable C and Python code.

 CPython abstracts the complexities of the underlying C platform and your Operating System. It makes threading cross-platform and straightfoward. It takes the pain of memory management in C and makes it simple. CPython gives the developer writing Python code the platform to write scalable and performant applications. At some stage in your progression as a Python developer, you need to understand how CPython works. These abstractions are not perfect, and they are leaky.

 Once you understand how CPython works, you can optimize your applications and fully leverage its power. This book will explain the concepts, ideas, and technicalities of CPython. In this book you’ll cover the major concepts behind the internals of CPython, and learn how to:

  • Read and navigate the source code
  • Compile CPython from source code
  • Make changes to the Python syntax and compile them into your version of CPython 15 How to Use This Book
  • Navigate and comprehend the inner workings of concepts like lists, dictionaries, and generators
  • Master CPython’s memory management capabilities
  • Scale your Python code with parallelism and concurrency
  • Modify the core types with new functionality
  • Run the test suite
  • Profile and benchmark the performance of your Python code and runtime
  • Debug C and Python code like a professional
  • Modify or upgrade components of the CPython library to contribute them to future versions

 Take your time for each chapter and make sure you try out the demos and the interactive elements. You can feel a sense of achievement that you grasp the core concepts of Python that can make you a better Python programmer.

If you liked this book, share it with your friends, thus you help us develop and add more interesting and necessary books for you!