Skip to main content
Join the official Python Developers Survey 2018 and win valuable prizes: Start the survey!

Python module to generate and modify bytecode

Project description

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)

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Filename, size & hash SHA256 hash help File type Python version Upload date
bytecode-0.4-py3-none-any.whl (34.4 kB) Copy SHA256 hash SHA256 Wheel 3.4 Apr 12, 2016
bytecode-0.4.tar.gz (42.1 kB) Copy SHA256 hash SHA256 Source None Apr 12, 2016

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN SignalFx SignalFx Supporter DigiCert DigiCert EV certificate StatusPage StatusPage Status page