
On 07.02.2021 0:24, Paul Sokolovsky wrote:
Hello,
On Sun, 7 Feb 2021 00:00:41 +0300 Ivan Pozdeev via Python-Dev <python-dev@python.org> wrote:
Who said "__future__"? Other people said __future__. And yet other said "it's ok the way it is, it's better to have it like that then keep not having it". And yet other said something else (multiple else's).
I said "3rd-party library". Independent from the CPython project. Maybe even a few of them -- to try out conflicting visions that emerged in the discussions. Such libraries exist for decade(s). MacroPy is a venerable, well-known macro-capabilities-for-Python solution, which offers a kind of pattern matching: https://macropy3.readthedocs.io/en/latest/pattern.html . There're a bunch of other, grep github.
https://github.com/MegaIng/syntax-extensions-pep634 specifically advertises itself as pure-Python implementation of PEP634 (using a newer macro library), though I'm not sure how well it's development. It also of course represents the right way to develop Python - in Python itself. Sadly, "C" in "CPython" is stuck too deep in many minds...
Bottom line is however: given the decade(s) old history of pattern matching in *Python* (usual warning: don't mix up Python and CPython!), arguing that very resourceful attempt to add pattern matching to the reference implementation (that's where *CPython* finally pops up), should be flushed down the toilet and the Python community should be brought back into decade-long waiting state without a reference implementation for pattern matching - umm, suggesting that doesn't seem to be very productive.
That's not the impression I got from looking through the discussiuon and the PEP. I don't see references to any of those existing implementations anywhere in the PEP as well as a summary of various existing approaches and solutions, their pros and cons etc. which the proposal proper would derive its particulars from. Both the PEPs and the discussion look like they are trying to write the functionality completely from sctratch, by the seat of their pants. And from how much discord there is about syntax and semantics, I conclude that these are far from being well-established and practice-proven. So if the existing solutions really have a "decades-long history" as you claim, that history must be spectacularly uneventful -- which suggests that the feature is either in low demand or was ultimately proven by practice to be inadequate for real-world use.
On 06.02.2021 23:58, Steve Holden wrote:
My suggestion that it be introduced via __future__ due to its contentious nature met immediate resistance. No point going down that road.
Kind regards, Steve
On Sat, Feb 6, 2021 at 8:15 PM Ivan Pozdeev via Python-Dev <python-dev@python.org <mailto:python-dev@python.org>> wrote:
With such a large new area of functionality that's at odds with existing syntax and semantics and a lack of clear vision and agreement, it sounds like this would be better first added as a 3rd-party library to let the syntax and semantics mature. (To allow new syntax, it'll probably be parsing strings in that special syntax.)
(At https://www.python.org/dev/peps/pep-0634/ <https://www.python.org/dev/peps/pep-0634/>, there's no indication that this option was considered.)
[]
-- Regards, Ivan