by kortex · 5y ago · 0 comments
So have your dynamic language functions you have to document (you do document your code right?), why not just use types instead? I'd far rather see
def frob(data: np.ndarray) -> float:
<code with no docstring>
than def frob(data):
"""takes an array and frobs it to give the frobitude score"""
Like, idk about you, but the former is way better at "self documenting" and you can do all kinds of automatic operations on it. If things are ill-defined and quickly shifting, I can mypy and flake my way to make sure the stack works without bricking something. If I have human docs, that's far more likely to drift out of date.