Skip to content
Opensource internals
  • Posts

Posts

All posts published on this site.

Everything published here, newest first.

CPython's slice Implementation in C: Three Objects and a Bunch of Clamping

Oct 20, 2026 9 min read Jay Hubbert

A slice is just three PyObject pointers — but turning them into real indices takes two clamping passes, and None becomes a sentinel meaning ‘use the extreme bound’.

PythonCpythonInternalsSlice

Read more →

CPython's str Implementation in C (Unicode): One Byte per Character When You Can

Oct 20, 2026 10 min read Jay Hubbert

A CPython str picks the narrowest of 1, 2, or 4 bytes per code point at allocation time — so an all-ASCII string is one allocation with no UTF-8 cache at all.

PythonCpythonInternalsStrUnicode

Read more →

CPython's structseq Implementation in C (PyStructSequence): Tuples With Names

Oct 20, 2026 9 min read Jay Hubbert

A struct sequence is a tuple subclass whose hidden fields live past ob_size in the same allocation — so len() sees only the visible ones while attributes see everything.

PythonCpythonInternalsStructseq

Read more →

CPython's super() Implementation in C: Cooperative Multiple Inheritance

Oct 20, 2026 8 min read Jay Hubbert

super() is not special syntax — it’s a three-pointer C object, and the compiler even skips building one for super().attr via the LOAD_SUPER_ATTR bytecode.

PythonCpythonInternalsSuperMro

Read more →

CPython's Template String Implementation in C (t-strings): Interpolation as Data

Oct 20, 2026 11 min read Jay Hubbert

t-strings produce a Template object — literal strings plus Interpolation objects — not a formatted string, so the pieces stay inspectable and reusable.

PythonCpythonInternalsStringsTemplate

Read more →

← Newer Page 22 of 53 Older →

© 2026 Jay Hubbert · Built with Hugo 0.168.0

RSS ·