On Sun, Oct 10, 2021 at 12:27 PM Patrick Reader <_...@pxeger.com> wrote:

> On 10/10/2021 18:33, Guido van Rossum wrote:
>
> On Sun, Oct 10, 2021 at 10:28 AM Brandt Bucher <brandtbuc...@gmail.com>
> wrote:
>
>> the peephole optimizer shouldn’t be tasked with “fixing” poorly-written
>> or uncommon code… just improving common code.
>>
> Good point.
>
>
> As soon as this pattern appears in a benchmark suite we'll optimize it
> away. :-) (That is, *if* the optimizer can prove that it can't raise a name
> error.)
>
> Perhaps a more realistic case that definitely doesn't require a check to
> prevent NameErrors would be optimising `STORE_FAST x LOAD_FAST x` for same
> x. But as Steven D'Aprano has just pointed out, they're FAST lookups
> anyway, so the benefit may well be minimal anyway.
>

What's exasperating to me about this whole discussion is that nobody has
shown any reason why this kind of code would be occurring in user code.
STORE_FAST x LOAD_FAST x seems that it must come from a user writing

    x = x

But why would they write that? Are we just a solution (a clever peephole
trick) looking for a problem?

-- 
--Guido van Rossum (python.org/~guido)
*Pronouns: he/him **(why is my pronoun here?)*
<http://feministing.com/2015/02/03/how-using-they-as-a-singular-pronoun-can-change-the-world/>
_______________________________________________
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/UH4B3J7UHPWETBZYZFDMPSOKHRSRY372/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to