Le 09/01/2021 à 15:18, Paul Moore a écrit :
>
> But the PEP 642 form:
>
> case {"text" as message, "color" as c}:
>
> is essentially identical except for using "as" rather than a colon. My view
> is:
>
> 1. Nowhere else in Python does "as" indicate a dictionary, and braces
> alone don't (because sets use them too).
Admittedly. But *something* has to be found, right?
> 2. It loses the "match looks like the input" aspect, while only
> gaining some sort of theoretical "as is how we bind to the right"
> property that's never been a design principle in Python before now.
Is there an official catalog of Python design principles? "... as y" is
already (optionally) used in `import` and `with` statements, so this is
not an innovation in Nick's PEP.
> 3. It's entirely new syntax, where the PEP 634 form is similar to
> existing Python syntax for dictionaries, and to other languages'
> matching constructs.
As I said, using new syntax to denote a new semantics seems like the
right thing to do.
Regards
Antoine.
_______________________________________________
Python-Dev mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3/lists/python-dev.python.org/
Message archived at
https://mail.python.org/archives/list/[email protected]/message/VOQMNHBJ44Q2OMQJTDFHVZS2DI3CRL2B/
Code of Conduct: http://python.org/psf/codeofconduct/