[go: up one dir, main page]

Skip to main content
Apress

CPython

A Complete Guide to CPython's Architecture and Performance

  • Book
  • © 2025

Overview

  • Covers CPython’s components, from data structures to memory, offering an insider view of Python’s architecture
  • Hands-on CPython source code mods, including REPL tweaks, let readers engage with Python's inner workings
  • Covers bytecode and VM operations, enabling readers to optimize Python and gain a deep understanding of its core design
  • 4249 Accesses

This is a preview of subscription content, log in via an institution to check access.

Access this book

eBook EUR 49.99
Price includes VAT (France)
  • Available as EPUB and PDF
  • Read on any device
  • Instant download
  • Own it forever
Softcover Book EUR 63.29
Price includes VAT (France)
  • Compact, lightweight edition
  • Dispatched in 3 to 5 business days
  • Free shipping worldwide - see info

Tax calculation will be finalised at checkout

Other ways to access

Licence this eBook for your library

Institutional subscriptions

About this book

Deep Dive CPython explores the internal mechanics of CPython, the widely used Python interpreter written in C. Starting with a practical guide on downloading and compiling the CPython source, this book is perfect for developers eager to understand Python’s behaviour at a fundamental level.

The book takes readers from basic concepts to complex details with a systematic breakdown of core components. It covers everything from CPython’s data structures like PyObject and PyTypeObject to object lifecycle management, giving insight into memory allocation and object reference counting. Each chapter illustrates CPython's architecture, such as Python's "everything is an object" philosophy, list handling, string manipulation, and dictionary operations. Readers will explore Python’s REPL modifications, string internals, and custom type creation with practical examples, like crafting a "backflipping" PyKitty_Type. Detailed sections on Python’s virtual machine operations, bytecode generation, and exception handling enrich readers’ understanding of how Python code is parsed, compiled, and executed.

This book is a thorough guide for readers who want to go beyond basic Python use and understand how it works internally. Covering complex concepts like generators, iterators, descriptors, and metaclasses, this book equips readers with a thorough grasp of Python's performance optimization and design complexities.

What you will learn:

  • How to download, compile, and modify CPython's source code
  • Gain insight into fundamental structures like PyObject and PyTypeObject,
  • Understand Python's detailed handling of lists, strings, dictionaries, and the REPL environment.
  • What are bytecode generation, custom types, and the inner workings of Python’s virtual machine.

Who this book is for:

Python programmers aiming to gain a deeper understanding of Python’s internals and move beyond standard usage, as well as software professionals interested in CPython’s C-based implementation and core architecture.

 

 

Similar content being viewed by others

Table of contents (30 chapters)

Authors and Affiliations

  • Taipei, Taiwan

    Chien-Lung Kao

About the author

Kao Chien Lung is a seasoned programmer with over 25 years of hands-on experience and 15 years as an educator, specializing in JavaScript, Ruby, and Python. He is a respected author of several books on Ruby on Rails and Git published in Taiwan, sharing his in-depth knowledge and insights with a global audience. Kei has also been a featured speaker at conferences and tech events across Asia, including Taiwan and Japan, where he connects with developers and tech enthusiasts on advanced programming techniques and industry trends.  

 

Accessibility Information

PDF accessibility summary

This PDF has been created in accordance with the PDF/UA-1 standard to enhance accessibility, including screen reader support, described non-text content (images, graphs), bookmarks for easy navigation, keyboard-friendly links and forms and searchable, selectable text. We recognize the importance of accessibility, and we welcome queries about accessibility for any of our products. If you have a question or an access need, please get in touch with us at accessibilitysupport@springernature.com. Please note that a more accessible version of this eBook is available as ePub.

EPUB accessibility summary

This ebook is designed with accessibility in mind, aiming to meet the ePub Accessibility 1.0 AA and WCAG 2.2 Level AA standards. It features a navigable table of contents, structured headings, and alternative text for images, ensuring smooth, intuitive navigation and comprehension. The text is reflowable and resizable, with sufficient contrast. We recognize the importance of accessibility, and we welcome queries about accessibility for any of our products. If you have a question or an access need, please get in touch with us at accessibilitysupport@springernature.com.

Bibliographic Information

Keywords

Publish with us