[Python-ideas] Fwd: Pattern Matching Syntax

Andrés Delfino adelfino at gmail.com
Sat May 12 10:49:45 EDT 2018


I find it weird for case statements to be "inside" match statements.
There's isn't a statement "group" that works this way right now, AFAIK.

This would also be weird:

match X:
case Y:
...

I thought a form based on try would make more coherent:

match:
    suite
case x:
    suite1
else:
    suite2

suite would be executed, and the last expression would be checked against
each case. If no matching case is found, suite2 would be executed.

Does it make sense?

On Sat, May 12, 2018 at 8:51 AM, Steven Heidel <steven at rigetti.com> wrote:

> Great! Also emailed you with logistics.
>
> On Sat, May 12, 2018, 01:43 Jelle Zijlstra <jelle.zijlstra at gmail.com>
> wrote:
>
>> 2018-05-11 22:01 GMT-04:00 Robert Roskam <raiderrobert at gmail.com>:
>>
>>> Hey Steven,
>>>
>>> I'm also at PyCon. Shall we take this off list and attempt to meet up
>>> and discuss?
>>>
>>> I'm also at PyCon and interested in meeting about this. I just wrote up
>> a basic and incomplete implementation for pattern-matching yesterday
>> between and after: talks: https://github.com/JelleZijlstra/cpython/blob/
>> matchcase/Lib/test/test_matching.py. It's nowhere near complete, but an
>> implementation like this can help inform what the syntax should look like.
>>
>> --
>>
>> ---
>> You received this message because you are subscribed to a topic in the
>> Google Groups "python-ideas" group.
>> To unsubscribe from this topic, visit https://groups.google.com/d/
>> topic/python-ideas/nqW2_-kKrNg/unsubscribe.
>> To unsubscribe from this group and all its topics, send an email to
>> python-ideas+unsubscribe at googlegroups.com.
>> For more options, visit https://groups.google.com/d/optout.
>> _______________________________________________
>> Python-ideas mailing list
>> Python-ideas at python.org
>> https://mail.python.org/mailman/listinfo/python-ideas
>> Code of Conduct: http://python.org/psf/codeofconduct/
>>
>> --
>>
>> ---
>> You received this message because you are subscribed to a topic in the
>> Google Groups "python-ideas" group.
>> To unsubscribe from this topic, visit https://groups.google.com/d/
>> topic/python-ideas/nqW2_-kKrNg/unsubscribe.
>> To unsubscribe from this group and all its topics, send an email to
>> python-ideas+unsubscribe at googlegroups.com.
>> For more options, visit https://groups.google.com/d/optout.
>>
>
> _______________________________________________
> Python-ideas mailing list
> Python-ideas at python.org
> https://mail.python.org/mailman/listinfo/python-ideas
> Code of Conduct: http://python.org/psf/codeofconduct/
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20180512/57375e1d/attachment.html>


More information about the Python-ideas mailing list