Re:Python 3.11: “Zero cost” exception handling
by boothby on Wednesday October 06, 2021 @12:26PM
(#28774993)
I thought I had a pretty good handle on Python internals, until some time early this year when I took an interest in the generated bytecode. I'd read plenty of the cpython source, written lots of cython extensions, etc., but somehow missed the middle piece.
Fortunately, it's really easy to get at the bytecode, and quite instructive. Random inquiry: how do generator functions work?
Fortunately, it's really easy to get at the bytecode, and quite instructive. Random inquiry: how do generator functions work?
From there, you can read how each of those bytecode instructions is implemented in ceval.c, which formerly_proven links to.edit: probably nice to have the actual disassembly of a list comprehension, too: