Skip to content

Commit

Permalink
Explain why Expression.index is hidden from the type checker
Browse files Browse the repository at this point in the history
  • Loading branch information
inducer committed Nov 3, 2024
1 parent 3a6c809 commit 210e3a1
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions pymbolic/primitives.py
Original file line number Diff line number Diff line change
Expand Up @@ -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]``.
Expand Down

0 comments on commit 210e3a1

Please sign in to comment.