[issue45907] Optimize literal comparisons and contains

2021-11-27 Thread Pablo Galindo Salgado
Pablo Galindo Salgado added the comment: On the other hand, we can probably just remove the TODO -- ___ Python tracker ___ ___ Pyth

[issue45907] Optimize literal comparisons and contains

2021-11-27 Thread Pablo Galindo Salgado
Pablo Galindo Salgado added the comment: I agree with Serhiy and Batuhan. Please reach to python-dev of you really want to pursue this even after what has been already discussed. -- resolution: -> rejected stage: patch review -> resolved status: open -> closed __

[issue45907] Optimize literal comparisons and contains

2021-11-27 Thread Batuhan Taskaya
Batuhan Taskaya added the comment: We just rejected the same issue 2 days ago. If you feel very strong about this; instead of creating new ticket in the same place, you might want to try python-dev instead. Re: the todo comment, feel free to send a patch that removes it. I don't thank that

[issue45907] Optimize literal comparisons and contains

2021-11-27 Thread theeshallnotknowethme
theeshallnotknowethme added the comment: List and sets as right operands in literal contains are optimized to constant tuples and frozensets, and I'd like to take this optimization a step further. -- ___ Python tracker

[issue45907] Optimize literal comparisons and contains

2021-11-27 Thread Serhiy Storchaka
Serhiy Storchaka 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, the

[issue45907] Optimize literal comparisons and contains

2021-11-26 Thread theeshallnotknowethme
theeshallnotknowethme added the comment: If this bug report isn't accepted, for how long would the TODO remain in `Python/ast_opt.c`? -- ___ Python tracker ___ __

[issue45907] Optimize literal comparisons and contains

2021-11-26 Thread theeshallnotknowethme
theeshallnotknowethme 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). -- ___ Python tracker ___

[issue45907] Optimize literal comparisons and contains

2021-11-26 Thread Raymond Hettinger
Raymond Hettinger added the comment: This PR looks to be the same as one that was recently rejected. Compare: https://github.com/python/cpython/pull/29639/files https://github.com/python/cpython/pull/29810/files See discussion at: https://bugs.python.org/issue45843 -- nosy:

[issue45907] Optimize literal comparisons and contains

2021-11-26 Thread theeshallnotknowethme
Change by theeshallnotknowethme : -- keywords: +patch pull_requests: +28042 stage: -> patch review pull_request: https://github.com/python/cpython/pull/29810 ___ Python tracker __

[issue45907] Optimize literal comparisons and contains

2021-11-26 Thread theeshallnotknowethme
New submission from theeshallnotknowethme : Most operations with literals are optimized as well, so why shouldn't the comparison/contain operators be? I created a new bug report for it because of this fact and the TODO in the `fold_compare` function in `Python/ast_opt.c`. -- component