Oscar Benjamin wrote:
> Under PEP 634 in general, for any class C, a pattern C(x) matches an object 
> C(x, y) and there's no way for C to override that. To me that is sufficiently 
> unintuitive in the abstract that no example is really needed to see where 
> there is room for improvement.

We originally kicked around (and at one point even implemented) a 
`__match_args_required__` attribute, which is an integer specifying a minimum 
required number of positional sub-patterns. For reasons I can't recall, though, 
it was eventually dropped. It would take care of this, and I imagine it could 
be quite painless to add it back if there was enough support.

Here's a query for related discussions: 
https://github.com/gvanrossum/patma/issues?q=__match_args_required__
_______________________________________________
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/JKZUE2BUDZQQHQLZK3IYBUNHYQWYMVA6/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to