Aim python library master (16) byteplay

[Library description]

You can play with the bytecode.

【program】

byteplay.py


# -*- coding: utf-8 -*-

from byteplay import Code
from pprint import pprint

def f(a, b):
    print (a, b)

f(3, 5)
# (3, 5)

c = Code.from_code(f.func_code)
pprint(c.code)
'''
[(SetLineno, 7),
 (LOAD_FAST, 'a'),
 (LOAD_FAST, 'b'),
 (BUILD_TUPLE, 2),
 (PRINT_ITEM, None),
 (PRINT_NEWLINE, None),
 (LOAD_CONST, None),
 (RETURN_VALUE, None)]
'''

【problem】

Because I want to manipulate bytecode  c.code[3:3] = [(ROT_TWO, None)] Was added to the program,  NameError: name 'ROT_TWO' is not defined I get an error ...

[Reference site]

pypi

Recommended Posts

Aim python library master (16) byteplay
Aim python library master (48) autopep8
Aim python library master (49) psidialogs
Aim python library master (55) namespaces
Aim python library master (46) browserplus
Aim python library master (30) chronyk
Aim python library master (3) workalendar
Aim python library master (42) speedrecorder
Aim python library master (37) slimurl
Aim python library master (44) pynetviz
Aim python library master (8) rolex
Aim python library master (7) numparser
Aim python library master (21) hy
Aim python library master (18) requests
Aim python library master (13) easydev
Aim python library master (20) pyyaml
Aim python library master (40) wordsegmentation
Aim python library master (43) cpmoptimize
Aim python library master (68) pazudorasolver
Aim python library master (58) faker
Aim python library master (11) nlist
Aim python library master (38) beautiful_print
Aim python library master (65) geopy
Aim python library master (2) vincenty
Aim python library master (59) logbook
Aim python library master (51) pyautogui
Aim python library master (10) timeit
Aim python library master (0) Links
Aim python library master (66) youtube-dl
Aim python library master (53) psutil
Aim python library master (22) htmltag
Aim python library master (9) WebHelpers
Aim python library master (32) sql
Aim python library master (60) colourettu
Aim python library master (64) pretty_cron
Aim python library master (61) nested-lookup
Aim python library master (47) deckor
Aim python library master (25) orderedset
Aim python library master (62) glances
Aim python library master (63) easygui
Aim python library master (19) riemann
Aim python library master (39) goless
Aim python library master (54) tqdm
Aim python library master (23) memory_utils
Aim python library master (27) benchit
Aim python library master (35) pywildcard
Aim python library master (14) pyknon
Aim python library master (15) brute
Aim python library master (50) xlwings
Aim python library master (31) adipy
Aim python library master (57) browsergui
Aim python library master (1) da-vinci
Aim python library master (33) human friendly
Aim python library master (4) ASCII Py
Aim python library master (28) verbal expressions
Aim python library master (5) terminal tables
Aim Node.js Library Master (3) python-runner
Python ast library
python algorithmic trading library
Python string manipulation master
Install python external library