On Thu, Jun 25, 2020 at 9:21 AM Rhodri James <rho...@kynesim.co.uk> wrote:
> Well, now is the time for expressing surprise :-p > > As I've said before, one of my main problems with the PEP is as you go > through it, more and more special cases and surprises appear, and the > consequences of earlier surprises generate more special cases and > surprises. You claim not unreasonably that it's easy to remember that > "_" is special in matches. Maybe you're right, but that decision has > consequences spelled out later in the PEP that are less easy to > remember. Another example: I had not previously thought the definition > of name patterns to be surprising, but apparently they are (it just > surprised me, at any rate). That consequently makes the definition of > constant value patterns, which I was already iffy about, really quite > surprising. > > Each individual learning curve might be small, but cumulative total by > the time you reach the end of the PEP is large. Simple match statements > will, with adequate squinting, look recognisably like other areas of > Python. Complex match statements won't. And that's a problem for > anyone who wants to be able to read someone else's code. > > Bear in mind I am predominantly a C programmer who uses Python from time > to time for tools and glue. If I have to put in effort to learn new > special-case rules in Python, that's an active discouragement; I'm > frankly unlikely to bother, and more likely to write those tools and > glue in C instead. I'm certainly much less likely to use someone else's > tools and glue if I have to re-read the spec to remind myself what all > the gotchas are. > On my personal "potentially inscrutable uses of a tool" this still rates well below list comprehensions, so there's that; the biggest pet peeve I have anymore is understanding at a glance what is and isn't an assignment. This is a draft PEP and a lot of discussion around making assignment vs matched classes more explicit, so it's not like this is going to be set in stone, and I doubt that most will ever use the more esoteric parts of the syntax. One way or another, this is going to be a far more capable, and thus complex, tool than a switch statement, so there's only so much obviousness you can ask for coming in blind.
_______________________________________________ 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/FIPQMOHWVYOPBFLH2MZN66Z2DM7TBWL7/ Code of Conduct: http://python.org/psf/codeofconduct/