Hacker News new | ask | show | jobs
by jane_red 2362 days ago
I feel like the primal joy of programming in Python is somehow lost between those type hints. Type hints even though being very useful do look alien in Python. I myself like type hinting but cannot get rid of the feeling. Funny, but in reality, most people fail to find that sweet middle ground of "optionality". We have a middle-sized project in Python where every single object is type hinted, even if it is a simple one-liner function. And at some point you start having a feeling that if that is what Python development looks like, there must be something we are missing. But what are the actual reasons of overdoing it? Could it be your prior long-term exposure to the typed languages, magic IDE plugin or is it just an opinionated attempt to push the language into unnatural domain? I can't help but keep asking myself these whenever I see such heavily verbose Python code.
1 comments

I'm currently working in a Python codebase that I love specifically because it uses type hints judiciously. They're particularly useful when you're calling a library function that has an unexpected return type, and particularly useless when you're passing around a string that's obviously a string.