Tim Peters <t...@python.org> added the comment:

I hate this change :-(  The code generated for something like this today:

def f():
    if 0:
        x = 1
    elif 0:
        x = 2
    elif 1:
        x = 3
    elif 0:
        x = 4
    else:
        x = 5
    print(x)

is the same as for:

def f():
    x = 3
    print(x)

No tests or jumps at all.  That made the optimization an extremely efficient, 
and convenient, way to write code with the _possibility_ of using different 
algorithms by merely flipping a 0 and 1 or two in the source code, with no 
runtime costs at all (no cycles consumed, no bytecode bloat, no useless 
unreferenced co_consts members, ...).  Also a zero-runtime-cost way to 
effectively comment out code blocks (e.g., I've often put expensive debug 
checking under an "if 1:" block).

----------
nosy: +tim.peters

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

Reply via email to