2 ms·
I was worried about that example, but the problem doesn't seem to be too bad, because the spec says: « A match statement may have at most one irrefutable case
by mjw1007 6y ago
I was worried about that example, but the problem doesn't seem to be too bad, because the spec says:
« A match statement may have at most one irrefutable case block, and it must be last. »
So if I understand correctly the following will be an import-time error.
NOT_FOUND = 404
I_AM_A_TEAPOT = 418
match status_code:
case NOT_FOUND:
print("HTTP Not Found")
case I_AM_A_TEAPOT:
print("HTTP I'm a teapot")