by dfinninger · 7y ago · 0 comments
Great for smaller ones too! I type annotate every function, even
def parse_args() -> argparse.Namespace:
pass
at the top of simple scripts. With a good IDE (VS Code fits here too), the extra language lookups/insight you get are awesome. Command+mouse_hover gives me a great bit of information about args passed into the function if I annotate the inputs.I agree that statically typed languages are preferable. I don't consider static typing optional so I'm glad Python is growing a solution that supports it, though.
In my experience, mypy works surprisingly well. It doesn't hurt my coding speed at all but enhances it to levels that were not previously possible in Python, due to a lack of typing. False positives are rather rare.