This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

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 <1562360821.98.0.779728775472.issue37500@roundup.psfhosted.org>
In-reply-to
Content
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).
History
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: <1562360821.98.0.779728775472.issue37500@roundup.psfhosted.org>
2019-07-05 21:07:01tim.peterslinkissue37500 messages
2019-07-05 21:07:01tim.peterscreate