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

2020年6月29日 05:24:42 -0700

On 27/06/2020 10:36, Stephen J. Turnbull wrote:
Richard Damon writes:
 > As long as the bindings in match also make the symbol a local
 > (which seems reasonable) then you would get a similar restriction.
It's quite different. First, it surely won't make other symbols
match-local. Of course there will be times when you do all the work
inside the match statement. But often you'll want to do bindings in a
match statement, then use those outside. The second problem is that
this use of '_' isn't optional. It's part of the syntax. That means
that you can't use the traditional marking of a translateable string
(and it's not just tradition; there is a lot of external software that
expects it) in that scope.
So it's practically important, if not theoretically necessary, that
'case _' not bind '_'.
That's the clearest explanation of why "_" needs to be treated carefully, but I don't think it argues for the PEP's special treatment. Those people like me who just write for ourselves and don't care about internationalisation use "_" like any other variable with a strong implication that it's a dummy, so don't really care. Those people like you who care about internationalisation presumably avoid using "_" anyway, so the PEP's usage goes against your current instincts.
--
Rhodri James *-* Kynesim Ltd
_______________________________________________
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/RXUG2UJCSINOMBHSWWIPIUAGLVRTEMNH/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to