On 12/07/2020 23:20, Guido van Rossum wrote:
> So can we please lay this one to rest?
Sure. One small thing before we leave it; I've decided I don't care
about the special cases of not using _. to lead class names, but
forbidding **_ in mapping patterns seems unnecessary. I know it's
redundant, but I can imagine using it for emphasis. I can't think of
anywhere else the language forbids something just because it isn't
needed, though I didn't get a lot of sleep last night and I could well
be missing something obvious :-)
I’d rather not. And the argument about disallowing obviously redundant syntax seems weak. My worry about allowing this is that it’ll be cargo culled and we’ll see it used not for emphasis (of what? The obvious?) but because people think it’s needed. And that’s just clutter.
Can I use pattern matching to pull byte strings apart? I thought I
could, but trying it out in the playground didn't work at all. :-(
It’s explicitly forbidden by the PEP, because we don’t want str or bytes to accidentally match sequence patterns. You could do ‘match list(b):’ if you really wanted to, but I think there are better tools for parsing bytes or strings.
—Guido