On Fri, 19 Feb 2021 at 15:41, Tobias Kohn <ko...@tobiaskohn.ch> wrote:
>
> Hi Mark,
>
> Thank you for your proposal to try and have more precise semantics for 
> pattern matching.  Of course, the proposal primarily introduces a new and 
> extended protocol for pattern matching, upon which the 'semantics' is then 
> based.  I think it is important to recognise and discuss your work on this 
> basis that it proposes a different protocol of how pattern matching works, 
> before we consier whether your semantics really is 'more precise'.
...
>
> If you go back and look at the history and development of PEP 634, you will 
> find that we started off with a fully customisable method that we called 
> `__match__` instead of `__deconstruct__`.  The idea of more flexible and 
> customisable pattern matching is thus certainly in the spirit of our proposal 
> as well.  However, we finally removed this part from our proposal due to 
> strong concerns from the community that the match protocol is too complex, 
> particularly for an initial version of pattern matching.  Should the need 
> arise, it would still be possible to later add such a customisation protocol 
> in an upcoming version of Python.

It's not easy now to look back over the history of all of this. My
recollection of the original version of PEP 622 (if that's the right
one...) was that it had an overcomplicated protocol for __match__. It
needed to be simplified but in the end it was dropped.

The question now is if it will be straight-forward to retrofit a
protocol to PEP 634 after it is released and when backward
compatibility constraints kick in. PEP 653 (as discussed here) is
precisely an attempt to retrofit a protocol to PEP 634. I think the
difficulties involved in achieving that will become harder rather than
easier in future.

--
Oscar
_______________________________________________
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/QXEA5OQ5P75TS22ZQWYRNMVGT5GEFKPE/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to