
4 Feb
2022
4 Feb
'22
5:28 a.m.
I can, but it seems like the wrong usage of pattern matching and it requires much more code. ``` match m: case {"a": a, "b": b, **rest}: pass case _: raise ValueError ```
We can use pattern matching to unpack sequences, but we have special syntax for this: ``` s = range(100)
match s: case (a, b, *rest): pass case _: raise ValueError
(a, b, *rest) = s # solve same problem with one line ```