On 25/06/2020 10:15, Chris Angelico wrote:
On Thu, Jun 25, 2020 at 6:53 PM Antoine Pitrou <solip...@pitrou.net> wrote:
On Wed, 24 Jun 2020 12:38:52 -0700
Guido van Rossum <gu...@python.org> 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.
That argument works for name patterns, but not for class patterns.
"Cls(x,y)" does not look like an assignment target at all.
--
Rhodri James *-* Kynesim Ltd
_______________________________________________
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/XRKDUCQXHKHV3L4XJPF23BPHKGDBMBAI/
Code of Conduct: http://python.org/psf/codeofconduct/