Inconsistent Behavior of match-case Statement with Dict Literals {}
and dict()
Constructor
#106133
Labels
type-bug
An unexpected behavior, bug, or error
Bug report
The behavior of the match-case statement seems to be inconsistent when using dictionary literals
{}
anddict()
constructor in the case clause.Output
This suggests that the match-case statement first matches with the pattern that is defined using the same syntax ({} or dict()) as the input dictionary, regardless of the pattern order in the case clauses.
Expected Output
I would expect that the first statement would be matched in this case, regardless of how the dict is initialized.
Your environment
Python 3.10.12 | packaged by conda-forge | (main, Jun 23 2023, 22:41:52) [Clang 15.0.7 ] on darwin
The text was updated successfully, but these errors were encountered: