[Python-Dev] Opcode frequency

Antoine Pitrou solipsis at pitrou.net
Wed Jun 18 23:12:15 CEST 2008


Georg Brandl <g.brandl <at> gmx.net> writes:
> Agreed; is there a way for a JUMP to end up without popping the top
> after jumping? It would have to do a DUP first then.

For example:

>>> def f(x, y):
...  return x and y
... 
>>> import dis
>>> dis.dis(f)
  2           0 LOAD_FAST                0 (x)
              3 JUMP_IF_FALSE            4 (to 10)
              6 POP_TOP             
              7 LOAD_FAST                1 (y)
        >>   10 RETURN_VALUE        





More information about the Python-Dev mailing list