On 25/06/2020 00:54, Tim Peters wrote:
[Ethan Furman email@example.com]
"case _:" is easy to miss -- I missed it several times reading through the PEP.
As I said, I don't care about "shallow first impressions". I care about how a thing hangs together _after_ climbing its learning curve - which in this case is about a nanometer tall ;-)
You're not seriously going to maintain that you're struggling to grasp the meaning of "case _:" now, right?
I'm seriously going to maintain that I will forget the meaning of "case _:" quickly and regularly, just as I quickly and regularly forget to use "|" instead of "+" for set union. More accurately, I will quickly and regularly forget that in this one place, "_" is special.
while _ does not bind to anything, but of what practical importance is that?) .
One obvious way to do it is of major practical importance.
Yeah, but the "obvious" is being contended, and saying "but it's obvious" doesn't really constitute an argument to those of us for whom it isn't obvious.
".NAME" grated at first, but extends the idea that dotted names are always constant value patterns to "if and only if". So it has mnemonic value.
How do you get from "." to "iff" ?
See reply to Glenn. Can you give an example of a dotted name that is not a constant value pattern? An example of a non-dotted name that is? If you can't do either (and I cannot)), then that's simply what "if
or more likely
case (foo.x, foo.y)
for the first. For the second, it's a no-brainer that you can't have a non-dotted name as a constant value pattern, since the current constant value pattern mandates a leading dot.