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

dis.get_instructions

Prev: dis.findlinestarts | Up: dis | Next: dis.Instruction
Rel: dis.Bytecode, dis.code_info, dis.dis, dis.disassemble
Ref: docs.python.org — dis.get_instructions
Tags: #public #python3 #stdlib #dis


Import

import dis
from dis import get_instructions

Signature & Overview

dis.get_instructions(x, *, first_line=None, show_caches=None, adaptive=False)

Iterator for the opcodes in methods, functions or code Generates a series of Instruction named tuples giving the details of each operations in the supplied code.

Usage

import dis

ins = list(dis.get_instructions(lambda a, b: a + b))
assert any(i.opname == "RETURN_VALUE" for i in ins)

Gotchas

REPL Inspect

from dis import get_instructions
help(get_instructions)

Linked from

Related notes