If you've ever used python on a project above a certain size (both lines of code and people who contribute to it), type annotations quickly become something you find useful.
They shouldn't do that. I get how adding more checks obviously helps in a way, but only if you ignore the cost. It's not worth the effort that you could instead spend writing better tests. Most of the time your type is like FooFactory which doesn't tell you much anyway.
Then again it's not so bad if you're willing to make AI add all the types and not even care.
If you've ever used python on a project above a certain size (both lines of code and people who contribute to it), type annotations quickly become something you find useful.
I have, it didn't really help. It does help if you have no tests, but a large project needs tests.
I guess you don't use an IDE. Use VSCode or IntelliJ with auto completion and error highlighting as you type. Type hints are a blessing.
PyCharm does this without the hints
How would that work across files and libraries?
One problem is when people store different types in the same variable, what type is it at the time I use it.
Types save you cognitive effort and catch errors earlier, while writing code, not later when running or testing
They shouldn't do that. I get how adding more checks obviously helps in a way, but only if you ignore the cost. It's not worth the effort that you could instead spend writing better tests. Most of the time your type is like FooFactory which doesn't tell you much anyway.
Then again it's not so bad if you're willing to make AI add all the types and not even care.