On Mon, 4 Jan 2021, 2:19 am Barry Scott, <barry@barrys-emacs.org> wrote:

I quickly read 642 v3 and missed an explanation about why the syntax to match a string object is
str{} and not str. Are you saying that I MUST use {} so that when case is parsed its clear that its a class
with no constraints?


Yes. "str{}" would give a pure subclass check, "str()" would also be allowed for classes that define "__match_args__".



in the "Changes to class patterns" I read the BinaryOp example and
I thought from the above that it would also use {} and not ().
---
match expr:
    case BinaryOp(== '+', as left, as right):
---
I was expecting to see:
---
match expr:
    case BinaryOp{== '+', as left, as right}:
---

The example in the abstract doesn't show a class defined pattern that relies on __match_args__, only an instance attributes pattern.

Cheers,
Nick.