-
Given this code: T = TypeVar('T')
@dataclass()
class Element(Generic[T]):
value: T
parent: 'Element[Any] | None' = None
...
breadcrumbs = [self.current_element]
current = self.current_element
while current := current.parent:
breadcrumbs.append(current)
The above code causes mypy to complain:
How do I add annotations such that mypy can understand what's going on here? |
Beta Was this translation helpful? Give feedback.
Answered by
cjw296
Feb 5, 2025
Replies: 1 comment 6 replies
-
That seems like a bug in mypy, I would type ignore. |
Beta Was this translation helpful? Give feedback.
6 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
python/mypy#18608