[Python-Dev] Re: PEP 622: Structural Pattern Matching

2020年6月23日 15:59:20 -0700

On 06/23/2020 02:48 PM, Barry Warsaw wrote:
On Jun 23, 2020, at 13:50, Ethan Furman <[email protected]> wrote:
On 06/23/2020 12:49 PM, Barry Warsaw wrote:
Maybe the PEP could support this syntax:
 case in 401, 403, 404:
That seems like it would be both unambiguous and semantically obvious.
Unfortunately, that means:
 Is the object a three-tuple with the values 401, 403, and 404?
It would mean: is the object *in* a 3-tuple with values 401, 403, and 404, 
right?
If I understand the PEP correctly, then
 some_obj == (401, 403, 404)
 match some_obj:
 case 401, 403, 404:
 # this matches
--
~Ethan~
_______________________________________________
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/UBF7DNPS2TMKWPPB32DB6GA6YQKRCHKW/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to