On Sun, Jul 12, 2020 at 1:16 PM Jim J. Jewett <jimjjew...@gmail.com> wrote:

> Federico Salerno wrote:
> > On 11/07/2020 19:29, Jim J. Jewett wrote:
> > > To me, "else:" has a slightly different meaning than "case _:" ...
>
> > Could you construct two examples to prove behaviour would be different
> > between the two?
>
> The behavior would be identical; the difference is in why I put that
> behavior there.
>
>     match return_code:
>         case -1: ...
>         case 4: ...
>         case x if int(x) == x:
>             pass # This could be a "case _" if not for the guard
>     else:
>         raise TypeError("Return Code not an integer?!?: ", return_code)
>

I would write that as:

    match return_code:
        case -1: ...
        case 4: ...
        case x if int(x) != x:
            raise TypeError("Return Code not an integer?!?: ", return_code)
_______________________________________________
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/UPR3ZPYK5U4E5WO5BL4DBSZG52WWMG4D/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to