Thanks for the reply.

Independent of whether the spelling is encouraged, does the PEP in its current form consider `(name := _)` to be legal, or is `_` forbidden on the RHS of a `:=` by a similar argument to forbidding `_`  in `**_`?


On Wed, 24 Jun 2020 at 16:12, Guido van Rossum <> wrote:
On Wed, Jun 24, 2020 at 5:23 AM Eric Wieser <> wrote:
In regards to, was this alternative considered?
match obj:
    case SomeClass(field := _):  # is this already allowed by the PEP?
    case some_constant:  # my proposal: do not require `.some_constant` here
    case (other := _):  # is this already allowed by the PEP? If so, do we need the extra `case other:` spelling?

It seems like `:=` already provides all the necessary syntax for distinguishing bindings from constants, admittedly at the cost of 6 characters per binding (eg `Point(x := _, y := _)`) - so introducing additional syntax seems unnecessary.

In languages that have pattern matching, it is the primary way to extract pieces of a compound data structure into individual variables. For the use cases where match would be a good fit in Python, the same will be true. So using your proposed syntax here is too verbose to consider.
If this was considered but rejected for verbosity concerns, it would be nice to see it mentioned in the rejected alternatives section.

We can't discuss every single idea in that section. I don't think anyone else has proposed this, so I don't think it needs to be discussed for posterity. There are plenty of better ideas in this thread that deserve a mention there.

--Guido van Rossum (