On Mon, 29 Nov 2021 12:32:19 +0000
Mark Shannon <m...@hotpy.org> wrote:
> Hi,
> 
> I am surprised by the insistence on this thread for excluding comparisons 
> from constant folding.
> Why should we special case comparisons? Am I missing something here?

Is it actually special-cased or is it just not implemented?

IMHO at compile-time there's not much potential (for Python, which
doesn't have "true" constants).  At run-time and based on
specialization, there could be.

Regards

Antoine.


> 
> We already constant fold a variety of expressions
> 
> 0 * 7
> '' * 7
> True - True
> True * False
> 
> (All the above are falsey)
> 
> Excluding  1 < 2 seems inconsistent.
> 
> Cheers,
> Mark.



_______________________________________________
Python-Dev mailing list -- python-dev@python.org
To unsubscribe send an email to python-dev-le...@python.org
https://mail.python.org/mailman3/lists/python-dev.python.org/
Message archived at 
https://mail.python.org/archives/list/python-dev@python.org/message/253RQ2BTTVUEUBFAMULQBBUTMQB5EH2W/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to