Skip to content

Allow match and case to work with Integer, etc. #40454

@user202729

Description

@user202729

Problem Description

Currently

match 1:
	case 1: True

raises an error.

Proposed Solution

it could be implemented to work. Alternatively, the preparser could make the 1 in case 1: not converted to Integer(1), but if that is done, then

match 1r:
	case 1: True

will run the True, which may not be expected. (On the other hand that is what expected in Python...?)

Alternatives Considered

Additional Information

No response

Is there an existing issue for this?

  • I have searched the existing issues for a bug report that matches the one I want to file, without success.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions