On Mon, 4 Jan 2021, 2:19 am Barry Scott, <ba...@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. >
_______________________________________________ Python-Dev mailing list -- python-dev@python.org To unsubscribe send an email to python-dev-le...@python.org https://mail.python.org/mailman3/lists/python-dev.python.org/ Message archived at https://mail.python.org/archives/list/python-dev@python.org/message/D4ZSJUW4WFFWPWQWP23AAUSZ6AQXQT3M/ Code of Conduct: http://python.org/psf/codeofconduct/