[Python-ideas] Pattern Matching Syntax

Tim Peters tim.peters at gmail.com
Sat May 5 12:12:49 EDT 2018


[Tim]
>>>> ... I liked the way he _reached_ that conclusion:  by looking at real-
>>>> life Python code that may have been written instead to use constructs
>>>> "like this".  I find such examination far more persuasive than abstract
>>>> arguments or made-up examples.

[Serhiy]
>>> I would like to see such examination for PEP 572. And for all other
>>> syntax changing ideas.

[Tim]
>> I did it myself for 572, and posted several times about what I found.

[Serhiy]
> Could you please give links to these results? It is hard to find something
> in hundreds of messages.

It's no easier for me to find old messages, and you'd just ask for
more & more anyway ;-)  The "short course" I already gave didn't skip
anything vital:

    Short course:  I found a small win frequently, a large win rarely, but
    in most cases wouldn't use it.  In all I expect I'd use it significantly
    more often than ternary "if", but far less often than augmented assignment.

More importantly:

    But that's me - everybody needs to look at their own code to apply
    _their_ judgment.

It's _applying_ the approach I find persuasive & productive, not
someone else writing up the results of _their_ taking the approach.
I'm not trying to change peoples' minds - just suggesting a more
fruitful way (than abstract arguments, fashion, ...) to make up their
minds to begin with.


> I withdrew some my ideas and patches when my examinations showed that the
> number of cases in the stdlib that will take a benefit from rewriting using
> a new feature or from applying a compiler optimization is not large enough.

Bingo!  Note your "my examinations" in that.  Someone who hasn't done
their own examination is basically guessing.  They may or may not
reach the same conclusions if they did the work, but neither eloquence
nor confidence is a reliable predictor of whether they would.  Passion
may even be negatively correlated ;-)


More information about the Python-ideas mailing list