You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Thanks for filing. Looking at this, I think it's just a (slightly confusing) duplicate of #2008. Old issue, but we've recently made progress towards it. Last I checked the primer for the fix was starting to look not too bad (see hauntsaninja#4)
One way to work around is to move the assignment to a separate line from the annotation:
current: Element | None
current = self
See also:
from __future__ import annotations
from typing import Any
class Element:
value: int
parent: Element | None
def walk(self) -> None:
current: Element | None
current = self
while current := current.parent:
print(current.value)
Bug Report
@hauntsaninja suggested I raise this.
To Reproduce
Expected Behavior
Actual Behavior
Your Environment
The text was updated successfully, but these errors were encountered: