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

2020年6月25日 20:35:40 -0700

On 6/25/20 6:48 PM, Emily Bowman wrote:
> On Thu, Jun 25, 2020 at 3:41 PM Richard Damon
> <[email protected] <mailto:[email protected]>> wrote:
> > Actually, you could make _ less special by still binding the value to
>
> it, just make it special in that you allow several values to be bound,
> and maybe just define that the result will be just one of the values,
> maybe even specify which if you want.
>
>
> Like Guido said above, the problem is that _ is already effectively
> reserved for translated text. Combining the two would feel a bit
> weird, but should still be possible.
I thought _ was also commonly used as:
first, -, last = (1, 2, 3)
as a generic don't care about assignment. I guess since the above will
create a local, so not overwrite a 'global' function _ for translations,
so the above usage works as long as that function (or whatever namespace
you are in) doesn't use _ for translations. As long as the bindings in
match also make the symbol a local (which seems reasonable) then you
would get a similar restriction.
-- 
Richard Damon
_______________________________________________
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/M5HWPDG43KGHKM6JVH7ZAGK6YT7OYVJR/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to