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

2020年6月29日 12:54:57 -0700

Rhodri James writes:
 > 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. 
That depends on whether you care about taking advantage of the
convention that "_" is a dummy. In fact, _ = gettext partakes of that
convention: all the programmer need know about internationalization is
that non-English speakers might like to read the string in their own
language. From her point of view, _() is a no-op aka dummy.
 > 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.
I can't speak for others, but I use "_" as a dummy all the time. Of
course that means I need to take care to use a different convention in
code that assumes _ == gettext, but it's rarely needed in my
experience.
But if the use of _ as a dummy in "case _" becomes syntax, I can't use
a different dummy, can I? Or can I use a different dummy (such as
"xx" or "__") at the expense of binding it?
With the non-binding treatment of "case _", I don't have to worry
about it.
Steve
_______________________________________________
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/QZKQKSTM5LFIJ346XGJ4QYLCSGUKEFZK/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to