Serhiy Storchaka <storchaka+cpyt...@gmail.com> added the comment:

> It doesn't seem to make sense why other operations on literals are optimized 
> but these particular ones aren't optimized (much).

The existing optimizer optimizes the following cases (note that the parser does 
not produce negative or complex numbers, they are created by the optimizer):

   -1
   1-2j
   1/3
   16*1024
   2**32-1
   1<<12
   b'a'[0]

They all are extremely common. Virtually every Python file contain some of such 
expressions, and they are often used in loops. In contrary, it is difficult to 
find any example of using comparison operations with all constant operands.

----------

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

Reply via email to