On Sun, Nov 15, 2020 at 1:56 AM Chris Angelico <rosuav@gmail.com> wrote:
On Sun, Nov 15, 2020 at 4:28 PM Kyle Stanley <aeros167@gmail.com> wrote:
>
> FWIW, I'd like to add my +1 to usage of "as" for spelling class capture patterns. This is by far the clearest and easiest to read form I've seen thus far, and I suspect that it would be the easiest to explain to users already familiar with usage of "as" from other areas in Python. A new feature being as distinguishable as possible and easy to explain to existing users is very important in my book, and based on the responses, I think that the current "=" form used in PEP 634 for matching class patterns would be substantially more difficult for users to mentally parse and understand compared to "as".
>
> It's also worth considering new Python users that might have general OO experience but not with robust pattern matching (e.g. Java-heavy backgrounds). I could definitely see "case Point(x=a, y=b):" being confused for instantiation, whereas usage of "as" makes it more clear that something else is happening (hopefully leading them to search around for more info about Python pattern matching).
>

case Point(x=as a, y=as b):

That doesn't read well to me.

Or is there some other spelling of 'as' that makes better sense to you?

The post from Nick that I was primarily replying to used the following spelling: "case Point(x as a, y as b):".