A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://github.com/python/cpython/issues/112137 below:

Change dis output to display labels instead of offsets · Issue #112137 · python/cpython · GitHub

TODO:

Feature or enhancement
>>> def f():
...     for i in x:
...         if y:
...           z
... 
>>> dis.dis(f)
  1           RESUME                   0

  2           LOAD_GLOBAL              0 (x)
              GET_ITER
        L1:   FOR_ITER                22 (to L3)
              STORE_FAST               0 (i)

  3           LOAD_GLOBAL              2 (y)
              TO_BOOL
              POP_JUMP_IF_TRUE         2 (to L2)
              JUMP_BACKWARD           16 (to L1)

  4     L2:   LOAD_GLOBAL              4 (z)
              POP_TOP
              JUMP_BACKWARD           24 (to L1)

  2     L3:   END_FOR
              RETURN_CONST             0 (None)

This is easier to read than the current output of:

>>> dis.dis(f)
  1           0 RESUME                   0

  2           2 LOAD_GLOBAL              0 (x)
             12 GET_ITER
        >>   14 FOR_ITER                22 (to 62)
             18 STORE_FAST               0 (i)

  3          20 LOAD_GLOBAL              2 (y)
             30 TO_BOOL
             38 POP_JUMP_IF_TRUE         2 (to 46)
             42 JUMP_BACKWARD           16 (to 14)

  4     >>   46 LOAD_GLOBAL              4 (z)
             56 POP_TOP
             58 JUMP_BACKWARD           24 (to 14)

  2     >>   62 END_FOR
             64 RETURN_CONST             0 (None)

Linked PRs

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4