On Mon, Nov 29, 2021 at 10:11 AM Rob Cliffe via Python-Dev
<[email protected]> wrote:
>
> I am slightly surprised that it seems to be *easier* to fold selected
> constant expressions than to have more generic code to fold them all.
> Or at least, all those that don't contain containers, such as
>      1 in [0,1,2]

This is optimized to a tuple rather than a list (and if you used a set
instead of a list, it'd be optimized to a frozenset), but the 'in'
comparison isn't optimized. The common case where it's "x in [0,1,2]"
is optimized as far as it can be.

ChrisA
_______________________________________________
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/KV7E4ALZLNY7BNMCNDVLUZHPORRRMRCC/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to