[Python-ideas] Pattern Matching Syntax
Tim Peters
tim.peters at gmail.com
Fri May 4 13:48:23 EDT 2018
[Guido]
> Can I recommend going slow here? This is a very interesting topic where many
> languages have gone before. I liked Daniel F Moisset's analysis about the
> choices of a language designer and his conclusion that match should be a
> statement.
Just to be annoying ;-) , 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.
An observation: syntax borrowed from functional languages often fails
to work well in practice when grafted onto a language that's
statement-oriented - it only works well for the expression subset of
the language. and even then just for when that subset is being used in
a functional way (e.g., the expression `object.method(arg)` is usually
used for its side effects, not for its typically-None return value).
OTOH, syntax borrowed from a statement-oriented language usually fails
to work at all when grafted onto an "almost everything's an
expression" language.
So that's an abstract argument of my own, but - according to me -
should be given almost no weight unless confirmed by examining
realistic code. Daniel did some of both - great!
> ...
> A larger topic may be how to reach decisions. If I've learned one thing from
> PEP 572 it's that we need to adjust how we discuss and evaluate proposals.
> I'll think about this and start a discussion at the Language Summit about
> this.
Python needs something akin to a dictator, who tells people how things
are going to be, like it or not. But a benevolent dictator, not an
evil one. And to prevent palace intrigue, they should hold that
position for life. Just thinking outside the box there ;-)
More information about the Python-ideas
mailing list