finds.dev← search

// the find

dabeaz/python-cookbook

★ 4,023 · Python · updated Sep 2023

Code samples from the "Python Cookbook, 3rd Edition", published by O'Reilly & Associates, May, 2013.

The companion code for David Beazley and Brian Jones's Python Cookbook 3rd Edition (O'Reilly, 2013). It's a flat collection of runnable examples organized by chapter — data structures, iterators, metaprogramming, C extensions, concurrency. For Python 3.3 era idioms.

The C extension chapter (15) is unusually thorough — ctypes, SWIG, Cython, and raw C API all covered with working Makefiles and setup.py files, not just pseudocode. The concurrency chapter (12) includes a generator-based coroutine scheduler that predates asyncio and is still worth reading to understand what asyncio is actually doing under the hood. Examples are self-contained per-recipe, so you can run any single file without understanding the whole repo. Beazley wrote it, which means the metaprogramming and descriptor chapters are better than most dedicated tutorials on those topics.

Python 3.3 vintage: some idioms have been superseded (concurrent.futures existed but asyncio didn't, so the async networking examples use raw selectors and generator tricks that nobody writes today). No updates since 2023 and the last substantive change was years before that — the book is frozen in time. Zero tests; these are demonstration scripts, not reusable library code, so you can't tell if an example still runs without trying it. The directory naming is human-readable but machine-unfriendly — no package structure, no imports between recipes, nothing to install.

View on GitHub →

// want more like this?

We dig through GitHub every week and send a few repos picked for what you actually care about — each with an honest take like this one.

Get finds in your inbox → Search again →