Given
class PrintableKey(bytes):
__match_args__ = ('ch', )
@property
def ch(self) -> str:
return self.decode('UTF-8')
now
match event:
case PrintableKey(ch):
reveal_type(ch) # mypy thinks it's PrintableKey
versus
match event:
case PrintableKey(ch=ch):
reveal_type(ch) # mypy correctly deduces it's str
Originally posted by @mgedmin in #13804 (comment)