Serhiy Storchaka <storchaka+cpyt...@gmail.com> added the comment:
I do not think there are serious raesons for adding this optimization. The Python compiler was intentionally made simple for maintainability. Constant folding supports only base arithmetic and bits operations because they are often used in constant expressions (like 2**32-1 or 1<<18) and indexing because of b'A'[0]. Neither comparisons, nor boolean operators with constants are optimized, because such expression are uncommon, and the maintaining cost overdraws benefit. This is a similar case. I am -1 for this optimization. ---------- _______________________________________ Python tracker <rep...@bugs.python.org> <https://bugs.python.org/issue42754> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com