4 ms·
I don't want type annotations. Was kinda the point of Python not to deal with types.
by morshu9001 1y ago
I don't want type annotations. Was kinda the point of Python not to deal with types.
- surajrmal 1y agoIf 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.
- morshu9001 1y agoI have, it didn't really help. It does help if you have no tests, but a large project needs tests.
- never_inline 1y agoI 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.
- morshu9001 1y agoPyCharm does this without the hints
- never_inline 1y agoHow would that work across files and libraries?
- morshu9001 1y agoPresumably with static analysis. I don't know exactly how this works, but it's surprisingly good.
- verdverm 1y agoOne 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
- morshu9001 1y agoThey 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.