dis.Bytecode()
dis.Bytecode() is a Python function in the Dis Module category. Creates a Bytecode object for analyzing bytecode. The syntax is dis.Bytecode(x, *, first_line=None, show_caches=False, adaptive=False). Returns: Bytecode object. A typical example: bytecode = dis.Bytecode(hello)
for instr in bytecode:
print(instr.offset, instr.opname). A close sibling is dis.dis(), which disassembles Python bytecode for a function, generator, class, method, or code object. A close sibling is dis.get_instructions(), which returns an iterator over bytecode instructions for analysis. A close sibling is dis.code_info(), which returns detailed information about a code object. A close sibling is dis.show_code(), which prints detailed code object information. More about this category: Bytecode disassembler — dis, get_instructions, code_info. Related Dis Module entries: dis.dis(), dis.get_instructions(), dis.code_info(), dis.show_code(). This page is part of the free Python Reference documentation covering 978+ functions, methods, and modules with examples and parameter details. You can try dis.Bytecode() immediately in the Python playground, look up unfamiliar terms in the glossary, or return to the Python Reference homepage.