Hacker News new | past | comments | ask | show | jobs | submit login

I've been coming at this from the other side and writing typed Python for my little experiments. You can add just enough type hints to make life easier, but not go obsessive over it. Then vim with Python ale tells me if I've done the right thing in a deeply nested loop without having to actually execute it.



I've really embraced type annotation and mypy for Python. Partly because it really helps the Python language server in VS Code with autocomplete. It has also saved me a few times in pointing out some type mismatches and forcing me to really think about what I'm returning, etc. It also makes reading the code easier in terms of reasoning about it.


I've noticed this similarly switching to using typescript over javascript. I'm not a huge JS dev anyway so I don't use it much, but having type signatures to enforce requirements, but being able to turn them off when they get in the way is great for productivity. Of course in a productive environment I would probably enforce strictness of the types but for my own terrible front ends, I don't care


> It also makes reading the code easier in terms of reasoning about it.

For me that's huge. I work in a support role where I pretty much exclusively look after code other people have written. Without type hints when something blows up I need to follow the code all the way back to whenever the variables were initially substantiated so I can know what to expect and what I can do with it. If I have a type I know what I'm looking immediately and start building a model of things without back tracking.


I've been doing this for years, and can't go back. The typing module is pretty comprehensive now, and using pyls-mypy with an editor like Kate that has an LSP client means you can type check as you're writing Python code in your editor.




Consider applying for YC's Fall 2025 batch! Applications are open till Aug 4

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: