Python Internals
How lists, dicts, strings and ints really work under the hood.
6 notes · 29 min total
- 1Python Object ModelHow Python names point at objects, what every object carries in its header, and why reassignment never changes other names.3 min
- 2IntegerHow Python ints store arbitrary-size numbers, the small-int cache, what arithmetic really costs, and int gotchas in interviews.4 min
- 3StringsHow Python stores strings, what each string operation costs, why += in a loop is slow, and the methods you reach for in interviews.6 min
- 4ListWhy a Python list is a dynamic array of pointers, how append stays amortised O(1), and the mutation and copying traps to avoid.4 min
- 5DictHow Python's compact dict stores keys, resolves collisions with open addressing, keeps insertion order, and what makes a key hashable.4 min
- 6SortingHow to use Python's built-in sort well, plus how bubble, insertion, merge and quick sort work and when each one fits.8 min