On Tue., 3 Nov. 2020, 8:07 am Ethan Furman, <et...@stoneleaf.us> wrote:

> On 11/2/20 1:52 PM, Glenn Linderman wrote:
> > On 11/2/2020 1:42 PM, Guido van Rossum wrote:
> >> But we feel that `case x, x` can easily be misunderstood as "a tuple of
> two equal values"
> >
> > So what _is_ the syntax for "a tuple of two equal values" ?
> >
> > case x, ?x:  # comes to mind (not that it is in the PEP :))
>
> Using a guard statement:
>
>      case x, y if x == y
>

This example made me realise that I need to add test cases for "case x,
==x:" and "case x, is x:" to PEP 642's reference implementation (and text
to the PEP pointing out that explicit constraints can help address the
pattern back-reference problem).

Cheers,
Nick.


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

Reply via email to