On this page
  1. dis.show_code
  2. Import
  3. Signature & Overview
  4. Usage
  5. Gotchas
  6. REPL Inspect

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

REPL Inspect

from dis import show_code
help(show_code)

Linked from

Related notes