3 ms·
On the other hand, big codebases without type hints rely on their engineers remembering types of every argument. Or the functions being overly defensive. Each
by kroolik 4y ago
On the other hand, big codebases without type hints rely on their engineers remembering types of every argument. Or the functions being overly defensive.
Each to their own liking, I prefer knowing what argument types a function accepts so I don't need to think about it, and focus on writing business logic. If the function could accept more types, Id just improve it.
- Jensson 4y agoI used type hints everywhere in python, they are orthogonal to what I talked about.
- kroolik 4y agoIsn't your first paragraph all about not knowing what argument types the function accepts just looking at its declaration, as it defeats the purpose of using a dynamic language?
- Jensson 4y agoType hints supports generics and abstract interfaces, you use those to display what behaviour you are using within the function and then you try to do what you need in the function as dynamically as possible. That is for library code, maybe it would be too cumbersome to try to do that for code with less reuse. I have never worked on a large python codebase that wasn't a library so I'm not sure what is best there.