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 serhiy.storchaka
Recipients BTaskaya, Crowthebird, pablogsal, rhettinger, serhiy.storchaka
Date 2021-11-27.10:38:53
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1638009533.71.0.918228373497.issue45907@roundup.psfhosted.org>
In-reply-to
Content
> 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.
History
Date User Action Args
2021-11-27 10:38:53serhiy.storchakasetrecipients: + serhiy.storchaka, rhettinger, pablogsal, BTaskaya, Crowthebird
2021-11-27 10:38:53serhiy.storchakasetmessageid: <1638009533.71.0.918228373497.issue45907@roundup.psfhosted.org>
2021-11-27 10:38:53serhiy.storchakalinkissue45907 messages
2021-11-27 10:38:53serhiy.storchakacreate