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 that most people are going to see this as dict matching as "ignoring errors by default" and going against the Zen of Python, and I expect that we'll be answering questions about it for years to come. "Why did my match statement match the wrong case?" Naively, I too would expect that dicts should only match if the keys match with no left overs, and I would like to see the choice to ignore left overs justified in the PEP. 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? - which languages ignore extra keys? do users of those languages consider this feature a bug, a wart, or a feature? -- Steve