On Thu, Feb 3, 2022 at 11:53 AM Yurii Karabas <1998uriyyo@gmail.com> wrote:

Proposed syntax:

m = {"a": 1, "b": 2, "c": 3, "d": 4}

{a, b} = m # a: 1, b: 2
{a, b, **rest} = m # a: 1, b: 2, rest: {c: 3, d: 4}

as equivalent to this from PEP 634:
match m:
    case {"a": a, "b": b, **rest}:
    case _:
        raise ValueError

What I find particularly unsatisfying is that the left hand side syntax in your proposal {a, b, **rest} is not at all like, the case syntax {"a": a, "b": b, **rest} so that's twice as much syntax to learn. 
IF this is really used often enough that it is worth adding to the language it should be a variation of match, something like:

match m as  {"a": a, "b": b, **rest}

The match clause defaults to doing nothing if the value doesn't match but that's less useful here (and harder to deal with since figuring out that a, b, and rest are still unbound is clumsy, so I would agree that it should raise ValueError if there's no match.

--- Bruce