4 ms·
That's not been my experience. I frequently use or way and have both mypy/pyright enabled. Testing this toy function, from typing import List, Optional def f(
by Mehdi2277 5y ago
That's not been my experience. I frequently use or way and have both mypy/pyright enabled. Testing this toy function,
from typing import List, Optional
def f(x: Optional[List[int]]):
x = x or []
reveal_type(x)
mypy and pyright both show List[int] as type of x at the end and correctly drop None.