On 03/07/2020 00:12, Nick Coghlan wrote:
On Fri., 3 Jul. 2020, 2:27 am MRAB, <python@mrabarnett.plus.com> wrote:

IMHO, the assignment statement should remain as it is, not sometimes
assign and sometimes not.

There could be another form that does matching:

     try ?x, 0 = (4,5)


Huh, this made me wonder if "match/try" may fit people's brains better than "match/case". I know for me that I want to read case clauses the same way I would read them in C, which is thoroughly unhelpful.

The following looks weird though, so I don't think I actually like it in practice:

===
match shape:
    try Point(x, y):
        ...
    try Rectangle(x0, y0, x1, y1, painted=True):
        ...
===

I don't think it looks at all weird in this example, I think it reads quite naturally, in my brain at least.
It is maybe not quite so good when comparing with actual values:
    match value:
        try 42:
            ...
        try -1:
            ...
  And it has the virtue of adding one less keyword.

_______________________________________________
Python-Dev mailing list -- python-dev@python.org
To unsubscribe send an email to python-dev-leave@python.org
https://mail.python.org/mailman3/lists/python-dev.python.org/
Message archived at https://mail.python.org/archives/list/python-dev@python.org/message/H6ZNPMH5T5PY265DGSL7OMSZZH4UDJSJ/
Code of Conduct: http://python.org/psf/codeofconduct/