On Tue, Jun 23, 2020 at 9:12 AM Guido van Rossum <guido@python.org> wrote:
I'm happy to present a new PEP for the python-dev community to review. This is joint work with Brandt Bucher, Tobias Kohn, Ivan Levkivskyi and Talin.
...
I'll mostly let the PEP speak for itself:

I have an exploratory question. In this section:

The alternatives may bind variables, as long as each alternative binds the same set of variables (excluding _). For example:
match something:
    ...
    case Foo(arg=x) | Bar(arg=x):  # Valid, both arms bind 'x'
        ...
    ...

Tweaking the above example slightly, would there be a way to modify the following so that, if the second alternative matched, then 'x' would have the value, say, None assigned to it?

match something:
    ...
    case Foo(arg=x) | Bar() (syntax assigning, say, None to x?)
        ...
    ...

That would let Bar be handled by the Foo case even if Bar doesn't take an argument. I'm not sure if this would ever be needed, but it's something I was wondering. I didn't see this covered but could have missed it.

--Chris