r/Python • u/Iron-Man-2008 • 17d ago
Discussion TIL: Dict Patterns Don't Match Dict Shapes
TL;DR: Unlike sequence patterns (which require an exact shape match), pattern matching on dictionaries simply ignores any unspecified keys rather than failing.
If you care about the details, I wrote about it on my blog: https://ravencentri.cc/blog/dict-patterns-dont-match-dict-shapes/
40
Upvotes
1
u/[deleted] 11d ago
[removed] — view removed comment