| > I write Python in my day job and I _always_ start with types. It depends of the project. If you write a lot of flask/django code, writing the types is not that worth it except for a few functions/methods. > Without types, if I have the code `a = foo(x=1)` then I have to hunt down the source file for `foo()` No, you just hover the function and get the help() out of it in most framework and libs. Again, if your code is mainly using a well define, documented and popular framework/lib/api, that's not a big deal. And it certainly doesn't require YOU to add types. Or if you write a program that is contained in 1 to 5 files top. Not use for types. Or if you are writing your program in jupyter. And you most likely copy a snipet from the doc anyway. After all, if you see that the function you want to use return a AbstractTranscientVectorServiceFactory object, you can't do much with the information without the doc anyway. But let's be real, most functions in Python are named pretty explicitly, and return things that you expect like "iterable of numbers" or "file like object yielding utf8". Types are particularly useful in the cases if you are in a big project with a lot of custom code or in a domain either very complex or that you don't master very well. They are a good for of safety net and documentation at the same time. But they come at a cost and it's a good thing to be able to choose. |
If the help or comments tell you the types of arguments and return values, that is just static typing in the form of comments. Even more verbose than language level type annotations, yet much harder to parse for editors/IDEs/linters.