[Python-Dev] Re: Optimizing literal comparisons and contains

2021年11月29日 04:43:33 -0800

On 2021年11月29日 12:32:19 +0000
Mark Shannon <[email protected]> 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 -- [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/253RQ2BTTVUEUBFAMULQBBUTMQB5EH2W/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to