Re:Pyrefly: Python type checker and language server in Rust
by parhamn on Tuesday October 14, 2025 @09:42AM
(#45579952)
Whats the expected error in the example you gave? That x can't be none because it was received as a str?
[ Parent
| on HN ]
Re:Pyrefly: Python type checker and language server in Rust
by wiz21c on Tuesday October 14, 2025 @10:29AM
(#45580488)
isn't it perfectly valid to pass None to that function ? It's not like python enforces types at runtime nor at compile time. Right ?
Re:Pyrefly: Python type checker and language server in Rust
by Austizzle on Tuesday October 14, 2025 @10:47AM
(#45580739)
It's not valid from a typing perspective, but python will let you. If you want to disregard types though then none of this matters anyway and you won't get much benefit from these tools
Re:Pyrefly: Python type checker and language server in Rust
by yesb on Tuesday October 14, 2025 @10:54AM
(#45580828)
Sure, it's valid python to do that. By that logic you could also pass an int. But the context of this post is that you're using a static type checker.
Re:Pyrefly: Python type checker and language server in Rust
by robertlagrant on Tuesday October 14, 2025 @09:45AM
(#45579977)
Yes, exactly. x would have to be str | None to be reachable.
Re:Pyrefly: Python type checker and language server in Rust
by pawelkobojek on Tuesday October 14, 2025 @09:45AM
(#45579974)
Exactly - something along the lines of "Statement is unreachable".