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 Stephen.Tu
Recipients Stephen.Tu
Date 2013-04-13.17:17:57
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1365873477.58.0.16753210186.issue17718@psf.upfronthosting.co.za>
In-reply-to
Content
Here's a simple patch to optimize away constant boolean conjunctions/disjunctions. for example:

def foo():
    if 1 and 0:
        print("hi")

now disassembles into:
  7           0 LOAD_CONST               0 (None) 
              3 RETURN_VALUE 

while I realize more general techniques for achieving this have been proposed (ie http://bugs.python.org/issue1346238), this is a very simple, self-contained patch.
History
Date User Action Args
2013-04-13 17:17:57Stephen.Tusetrecipients: + Stephen.Tu
2013-04-13 17:17:57Stephen.Tusetmessageid: <1365873477.58.0.16753210186.issue17718@psf.upfronthosting.co.za>
2013-04-13 17:17:57Stephen.Tulinkissue17718 messages
2013-04-13 17:17:57Stephen.Tucreate