On Sun, 22 Nov 2020 at 01:27, Greg Ewing <[email protected]> wrote:
> That's a fairly complex bit of mental parsing to do
> when reading a case.

I agree, that's why I wrote pattern matching seems exotical to me. I
was accustomed by Python to read the code as if it's wrote in simple
English. I must admit this is not entirely true for more complex
features (generators, async etc), but I feel pattern matching
particularly less readable. So any effort to make it more readable is
good IMHO. My two cents of a simple programmer.

On Sun, 22 Nov 2020 at 01:43, Greg Ewing <[email protected]> wrote:
>
> On 22/11/20 1:07 pm, Henk-Jaap Wagenaar wrote:
> > On Sat, 21 Nov 2020 at 19:58, Glenn Linderman <[email protected]
> > <mailto:v%[email protected]>> wrote:
> >
> >     Don't () already indicate an expression to be evaluated?
> >
> > Does it?
> >
> > [(a, b)] = [(0, 1)]
>
> Presumably a comma would be needed to match a 1-tuple.
>
>     case (x): # matches the value of x
>
>     case (x,): # matches any 1-tuple and binds x

I think it could potentially be confused with a programmer style.
Parenthesis are optional for tuples. Someone could think it could also
write
case x:
to match the value of x, but actually it binds to x and it will be
hard to debug.
_______________________________________________
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/4B3XUSEZGCYCQMOFCGRQ3H76MT3GGTJ4/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to