<div dir="ltr"><br><br><div class="gmail_quote"><div dir="ltr">On Fri, 26 Feb 2016 at 06:34 Victor Stinner <<a href="mailto:victor.stinner@gmail.com">victor.stinner@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">I just released bytecode 0.1, to discuss a "stable" (released) API :-)<br>
<a href="https://pypi.python.org/pypi/bytecode" rel="noreferrer" target="_blank">https://pypi.python.org/pypi/bytecode</a><br>
<br>
Instr constructor is now: Instr(name, arg=UNSET, *, lineno=None).<br>
<br>
I added SetLineno pseudo-instruction. If Instr is created with no line<br>
number, the line number is inherited from previous instructions, from<br>
SetLineno, or from the first line number of the bytecode object<br>
(default: 1).<br>
<br>
Mandatory "Hello World" example:<br>
<br>
    from bytecode import Instr, Bytecode<br>
<br>
    bytecode = Bytecode()<br>
    bytecode.extend([Instr("LOAD_NAME", 'print'),<br>
                     Instr("LOAD_CONST", 'Hello World!'),<br>
                     Instr("CALL_FUNCTION", 1),<br>
                     Instr("POP_TOP"),<br>
                     Instr("LOAD_CONST", None),<br>
                     Instr("RETURN_VALUE")])<br>
    code = bytecode.to_code()<br>
    exec(code)<br></blockquote><div><br></div><div>Any reason you went with string constants instead of enums? </div></div></div>