Every story and comment from the Hacker News API, in a layout borrowed from 2001.
A comment on Python Anti-Pattern. Parent comment
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.
There are no comments on this comment yet.
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.