On Thu, Jun 25, 2020 at 6:53 PM Antoine Pitrou <[email protected]> wrote:
On 2020年6月24日 12:38:52 -0700
Guido van Rossum <[email protected]> wrote:
Everyone,
If you've commented and you're worried you haven't been heard, please add
your issue *concisely* to this new thread. Note that the following issues
are already open and will be responded to separately; please don't bother
commenting on these until we've done so:
- Alternative spellings for '|'
- Whether to add an 'else' clause (and how to indent it)
- A different token for wildcards instead of '_'
- What to do about the footgun of 'case foo' vs. 'case .foo'
(Note that the last two could be combined, e.g. '?foo' or 'foo?' to mark a
variable binding and '?' for a wildcard.)
I don't know if you read it, so I'll reiterate what I said :-)
"""
Overall, my main concern with this PEP is that the matching semantics
and pragmatics are different from everything else in the language.
When reading and understanding a match clause, there's a cognitive
overhead because suddently `Point(x, 0)` means something entirely
different (it doesn't call Point.__new__, it doesn't lookup `x` in the
locals or globals...). Obviously, there are cases where this is
worthwhile, but still.
AIUI, the case clauses are far more akin to *assignment targets* than
they are to expressions. If you see something like this:
[x, y] = foo()
then you don't expect it to look up x or y in the current scope, nor
to construct a list.