New submission from Sylvain Defresne <sdefre...@gmail.com>:

Python compiler detect some constant expression used in if / while statement 
and evaluate them at compilation. However, it does not perform some simple 
optimisation (evaluating not unary expression or checking if and or or 
expression are constant because of the first expression).

The attached patch allow Python to detect some more constant expression, and to 
optimise test like the following:

   if __debug__ and x:
       pass

   if not __debug__:
       pass

----------
components: Interpreter Core
files: compile.diff
keywords: patch
messages: 97631
nosy: sdefresne
severity: normal
status: open
title: Optimisation of if with constant expression
type: performance
versions: Python 3.2
Added file: http://bugs.python.org/file15836/compile.diff

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

Reply via email to