Feature or enhancement
Proposal:
When trying to use a class pattern to match on a non-class object, we currently get the following error message:
Traceback (most recent call last):
File "/tmp/test.py", line 2, in <module>
case len():
~~~^^
TypeError: called match pattern must be a class
The terminology "called match pattern" here is a bit confusing. It's not used anywhere else as far as I can tell, and for a beginner, it might read like something is actually being called here.
The documentation consistently refers to these patterns as "class patterns":
I am therefore suggesting to change the message to "class pattern must refer to a class".
See #103576 for a PR that previously changed this error message (from "… must be a type" to "… must be a class").
Has this already been discussed elsewhere?
This is a minor feature, which does not need previous discussion elsewhere
Links to previous discussion of this feature:
No response
Linked PRs