[issue2499] Fold unary + and not on constants

Alexander Belopolsky report at bugs.python.org
Fri Mar 28 05:05:18 CET 2008


New submission from Alexander Belopolsky <belopolsky at users.sourceforge.net>:

Before:

>>> dis(lambda:+2)
  1           0 LOAD_CONST               0 (2)
              3 UNARY_POSITIVE      
              4 RETURN_VALUE        
>>> dis(lambda:not 2)
  1           0 LOAD_CONST               0 (2)
              3 UNARY_NOT           
              4 RETURN_VALUE        

After:

>>> dis(lambda:+2)
  1           0 LOAD_CONST               1 (2)
              3 RETURN_VALUE        
>>> dis(lambda:not 2)
  1           0 LOAD_CONST               1 (False)
              3 RETURN_VALUE

----------
components: Interpreter Core
files: fold-unary.diff
keywords: patch
messages: 64613
nosy: belopolsky
severity: normal
status: open
title: Fold unary + and not on constants
type: resource usage
versions: Python 2.6
Added file: http://bugs.python.org/file9880/fold-unary.diff

__________________________________
Tracker <report at bugs.python.org>
<http://bugs.python.org/issue2499>
__________________________________


More information about the Python-bugs-list mailing list