Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Use standard terminology in class pattern error message #144702

Closed
Labels
interpreter-core(Objects, Python, Grammar, and Parser dirs)type-featureA feature request or enhancement
@sharkdp

Description

@sharkdp

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    interpreter-core(Objects, Python, Grammar, and Parser dirs)type-featureA feature request or enhancement

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions


      [8]ページ先頭

      ©2009-2026 Movatter.jp