STINNER Victor added the comment: > The 2 JUMP_ABSOLUTEs should be optimized away since the code is equivalent > to: if a and b and c: as in:
Oh, I misread this sentence. I read that you would like to replace "if a: if b:" with "if a and b:". But it can be optimized differently: the useless jump can be removed during the bytecode generation. I implemented replace "if a: if b:" with "if a and b:" in astoptimizer: https://bitbucket.org/haypo/astoptimizer/commits/195df21d1dc30a21d0330e84794186488f266c29#chg-astoptimizer/optimizer.py I already implemented removal of useless jumps in my second project, registervm: http://hg.python.org/sandbox/registervm/file/f720340910ea/Lib/registervm.py#l1756 Read this file to learn more about my registervm project: http://hg.python.org/sandbox/registervm/file/tip/REGISTERVM.txt ---------- _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue17430> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com