If someone wants to experiment such optimization, there is no need to modify the Python internal optimizer, it can be done externally: https://faster-cpython.readthedocs.io/ast_optimizer.html
For example, I implemented many optimizations like constant propagation and loop unrolling in my old AST fatoptimizer project: https://github.com/vstinner/fatoptimizer/blob/master/doc/optimizations.rst Optimizing "2 < 3" becomes more interesting when other optimizations are implemented, like constant propagation or loop unrolling. So "x=2; if x < 10: ..." can be optimized for example. Victor _______________________________________________ Python-Dev mailing list -- [email protected] To unsubscribe send an email to [email protected] https://mail.python.org/mailman3/lists/python-dev.python.org/ Message archived at https://mail.python.org/archives/list/[email protected]/message/DGJLWZ6TCLFC3KLN7KZ7ALMLB5QD6FSY/ Code of Conduct: http://python.org/psf/codeofconduct/
