PyMOTW: dis – Python Bytecode Disassembler
Originally posted
· 1 min read
The dis
module includes functions for working with Python bytecode by “disassembling” it into a more human-readable form. Reviewing the bytecodes being executed by the interpreter is a good way to hand-tune tight loops and perform other kinds of optimizations. It is also useful for finding race conditions in multi-threaded applications, since you can estimate where in your code thread control may switch.