Author tim.peters
Recipients aldwinaldwin, miss-islington, ned.deily, nedbat, p-ganssle, pablogsal, scoder, serhiy.storchaka, tim.peters, xtreak
Date 2019-07-05.21:07:01
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <>
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
        x = 5

is the same as for:

def f():
    x = 3

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).
Date User Action Args
2019-07-05 21:07:02tim.peterssetrecipients: + tim.peters, scoder, nedbat, ned.deily, serhiy.storchaka, p-ganssle, pablogsal, miss-islington, xtreak, aldwinaldwin
2019-07-05 21:07:01tim.peterssetmessageid: <>
2019-07-05 21:07:01tim.peterslinkissue37500 messages
2019-07-05 21:07:01tim.peterscreate