class Book:
    __match_args__ = ("title", "year")

    def __init__(self, title, year):
        self.title = title
        self.year = year


def func(item: Book):
    match item:
        case Book(title=str(title)):  # [match-class-bind-self]
            ...
        case Book(year=int(year)):  # [match-class-bind-self]
            ...
