def __str__(self):
output = [] <EOL>labeldict = {}<EOL>pendinglabels = []<EOL>for i, ( op, arg ) in enumerate( self ):<EOL><INDENT>if isinstance(op, Label):<EOL><INDENT>pendinglabels.append( op )<EOL><DEDENT>elif isinstance( op, SetLinenoType ):<EOL><INDENT>pass<EOL><DEDENT>else:<EOL><INDENT>while pendinglabels:<EOL><INDENT>labeldict[ pendinglabels.pop() ] = i<EOL><DEDENT><DEDENT><DEDENT>lineno = None<EOL>islabel = False<EOL>for i, ( op, arg ) in enumerate( self ):<EOL><INDENT>if isinstance( op, SetLinenoType ):<EOL><INDENT>lineno = arg    <EOL>output.append('<STR_LIT>') <EOL>continue <EOL><DEDENT>if isinstance(op, Label):<EOL><INDENT>islabel = True<EOL>continue <EOL><DEDENT>linenostr =  str(lineno) if lineno else '<STR_LIT>'<EOL>lineno = None<EOL>islabelstr = '<STR_LIT>' if islabel else '<STR_LIT>'<EOL>islabel = False<EOL>if op in hasconst:<EOL><INDENT>argstr = repr(arg)<EOL><DEDENT>elif op in hasjump:<EOL><INDENT>if arg in labeldict :<EOL><INDENT>argstr = '<STR_LIT>' + str( labeldict[arg] )<EOL><DEDENT>else :<EOL><INDENT>argstr = repr( arg )<EOL><DEDENT><DEDENT>elif op in hasarg:<EOL><INDENT>argstr = str( arg )<EOL><DEDENT>else:<EOL><INDENT>argstr = '<STR_LIT>'<EOL><DEDENT>line = '<STR_LIT>' % (<EOL>linenostr,<EOL>islabelstr,<EOL>i,<EOL>op,<EOL>argstr<EOL>)<EOL>output.append( line )<EOL><DEDENT>return '<STR_LIT:\n>'.join( output ) + '<STR_LIT:\n>'<EOL>
Convert the current contents into a nice disassembly in multiple
lines, in the manner of dis.dis. Here is a random sample:

2           0 SETUP_LOOP              24 (to 27)
            3 LOAD_FAST                0 (L)
            6 GET_ITER
      >>    7 FOR_ITER                16 (to 26)
           10 STORE_FAST               1 (item)