|
|
|
|
|
by pansa2
1954 days ago
|
|
Is it still the case that these two pieces of code have different behaviour? match status:
case 404:
return "Not found"
not_found = 404
match status:
case not_found:
return "Not found"
IIRC in an earlier proposal, the former would check for equality (`status == 404`) and the latter would perform an assignment (`not_found = status`). |
|
Edit: It is possible to use constants or variables in a case pattern, but they have to be dotted names to not be treated like a capture pattern. So this would work for your example: