On this page
dis.disassemble
Prev: dis.dis | Up: dis | Next: dis.disco
Rel: dis.Bytecode, dis.code_info, dis.dis, dis.disco
Ref: docs.python.org — dis.disassemble
Tags: #public #python3 #stdlib #dis
Import
import dis
from dis import disassemble
Signature & Overview
dis.disassemble(co, lasti=-1, *, file=None, show_caches=False, adaptive=False, show_offsets=False, show_positions=False)
Disassemble a code object.
Usage
import dis
import io
buf = io.StringIO()
dis.disassemble((lambda x: x + 1).__code__, file=buf)
assert "RETURN_VALUE" in buf.getvalue()
Gotchas
- Takes a
codeobject directly: Preferdis.dis()ordis.Bytecode()for higher-level inputs.
REPL Inspect
from dis import disassemble
help(disassemble)
Linked from
- tuts/python3/stdlib_module/dis
- tuts/python3/stdlib_module/dis/Bytecode
- tuts/python3/stdlib_module/dis/code_info
- tuts/python3/stdlib_module/dis/dis
- tuts/python3/stdlib_module/dis/disco
- tuts/python3/stdlib_module/dis/distb
- tuts/python3/stdlib_module/dis/findlabels
- tuts/python3/stdlib_module/dis/findlinestarts
- tuts/python3/stdlib_module/dis/get_instructions
- tuts/python3/stdlib_module/dis/Instruction
- tuts/python3/stdlib_module/dis/show_code
- tuts/python3/stdlib_module/dis/stack_effect
Related notes
- tuts/python3/stdlib_module/dis/Bytecode Linked here; links to this page; shared tags: #dis, #stdlib
- tuts/python3/stdlib_module/dis/code_info Linked here; links to this page; shared tags: #dis, #stdlib
- tuts/python3/stdlib_module/dis/dis Linked here; links to this page; shared tags: #dis, #stdlib
- tuts/python3/stdlib_module/dis/disco Linked here; links to this page; shared tags: #dis, #stdlib
- tuts/python3/stdlib_module/dis/distb links to this page; shared tags: #dis, #stdlib
- tuts/python3/stdlib_module/dis/findlabels links to this page; shared tags: #dis, #stdlib
- tuts/python3/stdlib_module/dis/findlinestarts links to this page; shared tags: #dis, #stdlib
- tuts/python3/stdlib_module/dis/get_instructions links to this page; shared tags: #dis, #stdlib
- tuts/python3/stdlib_module/dis/Instruction links to this page; shared tags: #dis, #stdlib
- tuts/python3/stdlib_module/dis/show_code links to this page; shared tags: #dis, #stdlib