HOME | DEUTSCH | IMPRESSUM | KIT

bachelor thesis (finished): Exhaustiveness check for Structural Pattern Matching in Python 3.10

Checking exhaustiveness for Structural Pattern Matching that are proposed in a current Python Enhancement Proposal (PEP 622, PEP 634). An examples is:

from dataclasses import dataclass

@dataclass
class Point:
    x: int
    y: int

def whereis(point: Point):
    match point:
        case Point(0, 0):
            print("Origin")
        case Point(0, y):
            print(f"Y={y}")
        case Point(x, 0):
            print(f"X={x}")
        case Point(x, y) if y > 3:
            print("Somewhere else")

Task:

Implementing an exhaustiveness check in Python based on mypy.

Prerequisits

Experience with Python is helpfull.

Keywords

Python, Pattern Matching 

Publications

Publication
Typinferenz und Vollständigkeitsüberprüfung für Structural Pattern Matching in Python

Advisors

Scientific Staff
Sebastian Graf
Former Staff Member
M.Sc. Johannes Bechberger