Thomas Kluyver added the comment:

I've updated Nick's patch so that test_dis and test_peephole pass again, and 
added a prototype ByteCode class (without any docs or tests for now, to allow 
for API discussion).

The prototype ByteCode is instantiated with any of the objects that 
get_instructions already accepts (functions, methods, code strings & code 
objects). Iterating over it yields Instruction objects. It has info(), 
show_info() and display_code() methods, which correspond to the code_info(), 
show_code() and disassemble() functions.

I've tried to go for names that make sense, rather than names that fit the 
existing pattern, because the existing pattern feels a bit messy. E.g. the 
show_code() function doesn't actually show the code, so I've called its method 
equivalent show_info().

----------
nosy: +takluyver
Added file: http://bugs.python.org/file29051/dis_api.diff

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue11816>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to