skip to navigation
skip to content

bytecode 0.5

Python module to generate and modify bytecode

bytecode is a Python module to generate and modify bytecode.

Install bytecode: python3 -m pip install bytecode. It requires Python 3.4 or newer.

Example executing print('Hello World!'):

from bytecode import Instr, Bytecode

bytecode = Bytecode([Instr("LOAD_NAME", 'print'),
                     Instr("LOAD_CONST", 'Hello World!'),
                     Instr("CALL_FUNCTION", 1),
                     Instr("POP_TOP"),
                     Instr("LOAD_CONST", None),
                     Instr("RETURN_VALUE")])
code = bytecode.to_code()
exec(code)
 
File Type Py Version Uploaded on Size
bytecode-0.5-py3-none-any.whl (md5) Python Wheel py3 2017-01-05 34KB
bytecode-0.5.tar.gz (md5) Source 2017-01-05 43KB