Hacker News new | ask | show | jobs
by jmt_ 1356 days ago
I don't disagree but I wish Python had builtin support for runtime type checking. I've thought about switching to Go or Rust for certain projects but Python's rich ecosystem makes it hard for me to switch, so for now I long for runtime type checking without needing an external library (e.g typeguard).
3 comments

Very much agree. It's one thing I really appreciated about how php added type annotations. You didn't need them but once you added them they became a gaurantee.
You can check types at runtime in python. You can even check values at runtime. Heck you can check the weather at runtime if you like. What’s the problem exactly?
You can configure vscode to fail on typing problems and it will show errors in your editor
So that's an IDE feature rather than a language level feature
Nope, that's a language level feature. Your code will also fail at runtime. The IDE is just turning it on.
I don't think that's how it works. Unless you install a library like typeguard python doesn't do runtime type validation