On Sun, 3 Jan 2021 at 16:26, Barry Scott <ba...@barrys-emacs.org> wrote: > I read the above and believe I know what it meant without needing to read the > PEP in detail. > I like that a lot.
Personally, I read it and was horribly confused. I worked out most of it, but I would *not* count it as intuitive or natural. Specific examples: case {"host" as host, "port" as port}: pass case {"host" as host}: pass I assume that's dictionary unpacking? It doesn't really look like anything else in Python, though, and it took me a while to work out. case object{.host as host, .port as port}: pass I can only guess at this. I assume "subclass of object with host and port attributes/properties"? But why use {...} for object access? And does that extend to Foo{...} meaning "subclass of Foo? There's no reason to assume yes or no to that. Overall, the whole thing feels like an attempt to invent some sort of syntax in reaction to the PEP 634 form - not having a logic in its own right, but simply with a driving principle of "don't be like PEP 534". It abandons any idea of "make matching look like the thing that's being matched" and replaces it with a completely new set of syntax, which lacks the intuitive nature that I expect from Python (and yes, I know that can be read as "I'm not familiar with it, so I don't like it" - that may indeed be all that it is, but I feel that it's a bit more fundamental than just that). I have not read the full PEP, so take this as very much a "first impression" reaction, but I'd avoid using this syntax, both in my own projects and in any project I contribute to. Honestly, I feel like I'd rather see pattern matching rejected altogether than see this version accepted. Paul _______________________________________________ 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/GFNGO5UZB67HKWN3WSKGMFYEPE3RAFMK/ Code of Conduct: http://python.org/psf/codeofconduct/