Thanks very much for the survey (which actually surprised me somewhat).
Regarding the suggested update for the PEP, I'll make a PR to change that
-- I agree it's worth saying it.
On Sat, Nov 21, 2020 at 5:00 PM David Foster wrote:
> On 11/19/20 10:08 PM, David Foster wrote:
> > I've completed m
On 11/19/20 10:08 PM, David Foster wrote:
I've completed my survey of how other languages use pattern matching to
match Mapping-like and dict-like types, especially focusing on whether
they ignore (𝔸) or disallow (𝔹) extra keys by default. [...]
To close the loop on this thread:
* Based on (1
On 11/15/20 12:11 AM, Steven D'Aprano wrote:
It would be good if the PEP gave a survey of the practical experience of
other languages with pattern matching:
- are there languages which require an exact match, with no left over
  keys? what issues, if any, do users have with that choice?
- whic
I'm in favor of keeping the PEP as it currently is. Mappings are naturally
structural subtypes of one another, therefore mapping patterns should be
consistent with class patterns.
car = Car(...)
match car:
case Vehicle():
pass
case Car(): # will never match
I'm in favor of keeping the PEP as it currently is. Mappings are naturally
structural subtypes of one another, therefore mapping patterns should be
consistent with class patterns.
car = Car(...)
match car:
case Vehicle():
pass
case Car(): # will never match
Go for it. This is a pretty minor issue but we want to get it right. Data
is helpful.
On Tue, Nov 17, 2020 at 06:58 David Foster wrote:
> On 11/15/20 12:11 AM, Steven D'Aprano wrote:
> > It would be good if the PEP gave a survey of the practical experience of
> > other languages with pattern mat
On 11/15/20 12:11 AM, Steven D'Aprano wrote:
It would be good if the PEP gave a survey of the practical experience of
other languages with pattern matching:
- are there languages which require an exact match, with no left over
keys? what issues, if any, do users have with that choice?
- whic
On 2020-11-15 at 19:11:15 +1100,
Steven D'Aprano wrote:
> On Sat, Nov 14, 2020 at 10:17:34PM -0800, Guido van Rossum wrote:
>
> > It’s a usability issue; mappings are used quite differently than sequences.
> > Compare to class patterns rather than sequence patterns.
>
> I'm keeping an open mind
On Sat, Nov 14, 2020 at 10:17:34PM -0800, Guido van Rossum wrote:
> It’s a usability issue; mappings are used quite differently than sequences.
> Compare to class patterns rather than sequence patterns.
I'm keeping an open mind on this question, but I think David
is right to
raise it. I think t
I’m surprised PEP 635 doesn’t explain this at least as well as 622?
Also in your example 1, the narrower pattern (three keys) should precede
the more general pattern (two). Again, same as class patterns. Or except
clauses (catch RuntimeError *before* Exception).
On Sat, Nov 14, 2020 at 22:49 Davi
On 11/14/20 10:17 PM, Guido van Rossum wrote:
It’s a usability issue; mappings are used quite differently than
sequences. Compare to class patterns rather than sequence patterns.
I just found the following explanation from the superceded PEP 622 as to
why extra keys are ignored:
> Extra keys
It’s a usability issue; mappings are used quite differently than sequences.
Compare to class patterns rather than sequence patterns.
On Sat, Nov 14, 2020 at 22:04 David Foster wrote:
> From PEP 636 (Structural Pattern Matching):
> > Mapping patterns: {"bandwidth": b, "latency": l} captures the
12 matches
Mail list logo