Closed mgedmin closed 1 week ago
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 https://github.com/python/mypy/issues/13804#issuecomment-2466177933
Given
now
versus
Originally posted by @mgedmin in https://github.com/python/mypy/issues/13804#issuecomment-2466177933