From 08b5c994efd9180c0479e4bde4bbad7205a4b0fb Mon Sep 17 00:00:00 2001 From: Andreas Kloeckner Date: Fri, 1 Nov 2024 12:21:24 -0500 Subject: [PATCH] Explain why Expression.index is hidden from the type checker --- pymbolic/primitives.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/pymbolic/primitives.py b/pymbolic/primitives.py index 4fb769b..0f92630 100644 --- a/pymbolic/primitives.py +++ b/pymbolic/primitives.py @@ -622,6 +622,9 @@ def __call__(self, *args, **kwargs) -> Call | CallWithKwargs: return Call(self, args) if not TYPE_CHECKING: + # Subscript has an attribute 'index' which can't coexist with this. + # Thus we're hiding this from mypy until it goes away. + def index(self, subscript: Expression) -> Expression: """Return an expression representing ``self[subscript]``.