# Bug report Since `__match_args__` is not mentioned in `_SPECIAL_NAMES` right now these two examples have different results: ```python @runtime_checkable class P(Protocol): x: int y: int class A: def __init__(self, x: int, y: int): self.x = x self.y = y assert isinstance(A(1, 2), P) is True ``` And: ```python @runtime_checkable class P(Protocol): __match_args__ = ('x', 'y') x: int y: int class A: def __init__(self, x: int, y: int): self.x = x self.y = y assert isinstance(A(1, 2), P) is False ``` Why I think that `__match_args__` is a special attribute and should not be checked in `isinstance`? 1. It might be useed for protocol itself in patma (new issue is on its way about it): ```python match A(1, 2): case P(x, y): print(x, y) ``` But, this does not work right now if `A` does not have `__match_args__`. Which is not really required for this case. 2. Several similar attributes like `__slots__` and `__weakref__` and `__annotations__` are ignored already Do others agree? CC @AlexWaygood for `@runtime_checkable` protocols I will send a PR with my proposed solution and tests :) <!-- gh-linked-prs --> ### Linked PRs * gh-110683 <!-- /gh-linked-prs -->
Activity
pythongh-110682: Ignore `__match_args__` from `__intancecheck__` in p…
sobolevn commentedon Oct 11, 2023
Related #110686
gvanrossum commentedon Oct 11, 2023
I agree that
__match_args__ought to be disregarded byisinstance()in this case.gh-110682: Ignore `__match_args__` from `__instancecheck__` in protoc…
AlexWaygood commentedon Oct 12, 2023
Sounds like the consensus is that this was really a "missing feature" rather than a bug, so we won't be backporting this
pythongh-110682: Ignore `__match_args__` from `__instancecheck__` in …