On this page
dis.show_code
Prev: dis.Instruction | Up: dis | Next: dis.stack_effect
Rel: dis.Bytecode, dis.code_info, dis.dis, dis.disassemble
Ref: docs.python.org — dis.show_code
Tags: #public #python3 #stdlib #dis
Import
import dis
from dis import show_code
Signature & Overview
dis.show_code(co, *, file=None)
Print details of methods, functions, or code to file.
Usage
import dis
import io
buf = io.StringIO()
dis.show_code(lambda x: x, file=buf)
assert "Name:" in buf.getvalue()
Gotchas
- Prints
dis.code_info(x)tofile(defaultsys.stdout).
REPL Inspect
from dis import show_code
help(show_code)
Linked from
Related notes
- tuts/python3/stdlib_module/dis/Instruction Linked here; links to this page; shared tags: #dis, #stdlib
- tuts/python3/stdlib_module/dis/stack_effect Linked here; links to this page; shared tags: #dis, #stdlib
- tuts/python3/stdlib_module/dis/Bytecode Linked here; shared tags: #dis, #stdlib
- tuts/python3/stdlib_module/dis/code_info Linked here; shared tags: #dis, #stdlib
- tuts/python3/stdlib_module/dis/dis Linked here; shared tags: #dis, #stdlib
- tuts/python3/stdlib_module/dis/disassemble Linked here; shared tags: #dis, #stdlib
- tuts/python3/stdlib_module/dis links to this page; shared tags: #stdlib
- tuts/python3/stdlib_module/dis/disco shared tags: #dis, #stdlib
- tuts/python3/stdlib_module/dis/distb shared tags: #dis, #stdlib
- tuts/python3/stdlib_module/dis/findlabels shared tags: #dis, #stdlib