On Sun, Nov 15, 2020 at 1:56 AM Chris Angelico <[email protected]> wrote:
> On Sun, Nov 15, 2020 at 4:28 PM Kyle Stanley <[email protected]> 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):".
_______________________________________________ Python-Dev mailing list -- [email protected] To unsubscribe send an email to [email protected] https://mail.python.org/mailman3/lists/python-dev.python.org/ Message archived at https://mail.python.org/archives/list/[email protected]/message/JBSWERRHKBYAB7OW5HS3E4FGVTXDTJUP/ Code of Conduct: http://python.org/psf/codeofconduct/
