In addition to the changes proposed here that go beyond PEP-634 (which
other people discuss), I find that many of the definitions fail to capture
some of the basic features of PEP-634, especially when nesting patterns.

Take for example: "case [int(), str()]". According to
https://www.python.org/dev/peps/pep-0653/#sequence-patterns that desugars
to:

if $kind & MATCH_SEQUENCE:
    if $list is None:
        $list = list($value)
    if len($list) == len([int(), str()]):
        int(), str() = $list   *# This is invalid!*
        if guard:
           DONE
In general, the way these semantics are defined non-recursively over
patterns won't be able to work with nested patterns.

I value the idea of having a more accurate definition of what the semantics
are, but this approach doesn't seem to work.

Best,   D.


On Thu, 18 Feb 2021 at 16:45, Mark Shannon <m...@hotpy.org> wrote:

> Hi everyone,
>
> I'd like to announce a new PEP.
> https://www.python.org/dev/peps/pep-0653/
>
> It builds on PEP 634 (Structural Pattern Matching: Specification), adding:
>
> More precise semantics.
> A bit more customization for complex classes.
>
> Its also a bit more robust and should be faster (eventually).
>
> The syntax is unchanged, and in most cases the semantics are the same.
>
> As always, comments and suggestions are welcome.
>
> Cheers,
> Mark.
> _______________________________________________
> Python-Dev mailing list -- python-dev@python.org
> To unsubscribe send an email to python-dev-le...@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/O4I345VHIQUXPDJWPDA54RWVXMYEEBRM/
> Code of Conduct: http://python.org/psf/codeofconduct/
>
_______________________________________________
Python-Dev mailing list -- python-dev@python.org
To unsubscribe send an email to python-dev-le...@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/6RGSDHU7ZB77RTWUS7IBTMCZNLV4NBJH/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to