Error message for `**` use in match-case

dct = {'a': 1, 'b': 2}
dct_1 = {'a': 1}
dct_2 = {'b': 2}
match dct:
  case {'b': 2, **dct_1}: print("using {'b': 2, **dct_1}", dct)

outputs,

using {'b': 2, **dct_1} {'a': 1, 'b': 2}

but,

match dct:
  case {**dct_1, 'b': 2}: print("using {**dct_1, 'b': 2}", dct)

gives error,

    case {**dct_1, 'b': 2}: print("using {**dct_1, 'b': 2}", dct)
                   ^^^
SyntaxError: invalid syntax

and,

match dct:
  case {**dct_1, **dct_2}: print("using {**dct_1, **dct_2))}", dct)

gives error,

    case {**dct_1, **dct_2}: print("using {**dct_1, **dct_2))}", dct)
                   ^^
SyntaxError: invalid syntax

in the documentation, it is mentioned that this is like a rule.
using ** more than once is not allowed, (although I do not know what could be the reason for it)
plus, using ** is only allowed at the end.

this thing appears to be pretty specific, which one would have to search in the documentation.
that is here,
https://docs.python.org/3/reference/compound_stmts.html#grammar-token-python-grammar-mapping_pattern

I think so, instead of,

SyntaxError: invalid syntax

there must be a description for it.

just found out there is a bit more going on here.
the case statement here does not care about these two,

dct_1 = {'a': 1}
dct_2 = {'b': 2}

that is even if I do,

match dct:
  case {'b': 2, **e}: print("using {'b': 2, **e}", dct)

then it would print,

using {'b': 2, **e} {'a': 1, 'b': 2}

so, the use of ** twice does not really have any meaning, but, this pattern,

match dct:
  case {**dct_1, 'b': 2}: print("using {**dct_1, 'b': 2}", dct)

I do not know why did they disable it, it could be used to match a dictionary and then 'b': 2.
but it raises an error.

One more situation could be seen here,

dct = {'a': 1, 'b': 2}
eee = '1'
match dct:
  case eee: print("using eee", dct)

which outputs,

using eee {'a': 1, 'b': 2}

here, again case does not care about the assignment,

eee = '1'

and,

case eee:

is more like a wildcard pattern matching

if I do something like this, (using '1' instead of eee in case statement)

dct = {'a': 1, 'b': 2}
eee = '1'
match dct:
  case '1': print("using '1'", dct)

then it would attempt at matching the dictionary dct with '1' and it fails (as expected), so, there is no output.

similar thing could be seen here,

dct = {'a': 1, 'b': 2}
dct_1 = {'a': 1}
dct_2 = {'b': 2}
match dct:
  case dct_1 | dct_2: 
    print("using dct_1 | dct_2", dct)

gives the error,

SyntaxError: name capture 'dct_1' makes remaining patterns unreachable

again the case statement does not care about the assignments,

dct_1 = {'a': 1}
dct_2 = {'b': 2}

whereas if we do,

dct = {'a': 1, 'b': 2}
dct_1 = {'a': 1}
dct_2 = {'b': 2}
match dct:
  case {'a': 1} | {'b': 2}: 
    print("using {'a': 1} | {'b': 2}", dct)

then it outputs,

using {'a': 1} | {'b': 2} {'a': 1, 'b': 2}

I do not know why did they disable it, it could be used to match a dictionary and then 'b': 2 .
but it raises an error.

That would be a new feature, one that looks very much like an existing feature but with very different meaning. Would you really want case {'a': 1, **e} to mean something different from case {**e, 'a': 1} ?

how would it have different meanings, both,

match x:
  case {'a': 1, **e}: ...

and,

match x:
  case {**e, 'a': 1}: ...

should match with a dictionary that contains at least {'a': 1}, and it could have more key-value pairs.
but for some reason, the second case is not allowed.

also, this appears to be the same as,

match x:
  case {'a': 1}: ...

without specifying **e.
or if we have,

match x:
  case {'a': 1}: print("using {'a': 1}", x)
  case {'a': 1, **e}: print("using {'a': 1, **e}", x)

then I do not think the second case would ever get triggered, as it appears to be the same as the first case.