Y
HN Search
Hacker News Search
new
|
comments
|
top
|
jobs
qwefsdf
searching Neon…
1.
▲
2.
▲
3.
▲
4.
▲
5.
▲
6.
▲
6 ms
·
1.
▲
by
qwefsdf
4y ago
With type hints you would model this as a Union type, i.e., Union[int, str]. This is perfectly legal with mypy and other Python type checkers.
2.
▲
by
qwefsdf
4y ago
That's an Optional[int]. It's not "mixed types", it's a union type.
3.
▲
by
qwefsdf
4y ago
Anybody claiming it's almost Python is kidding themselves. This compiler needs to do static type checking. This is inherently impossible in Python. Not just because of some obscure corner cases that nobody uses. It's baked into th