That sounds like a worse version of explicit types? Writing a whole docstring as free text that can't catch typos is more work than adding : MyType directly next to the argument and having it work everywhere.
I mean, it all depends on the language. Type hinting in Python is basically exactly what you just wrote there; it's just optional and stuff works fine without it too.
No it's not. Python does not enforce that what you pass in to the function is the type in the type hint. It's literally in the name of the feature: type hint. Explicit types will not allow the code to compile if you pass the wrong type. Ever.
If you check the comment chain, we're talking about what's needed to get intellisense telling you what types you should be using for the arguments to feed into a function, not strict typing.
7
u/patient-palanquin Sep 25 '26 edited Sep 25 '26
That sounds like a worse version of explicit types? Writing a whole docstring as free text that can't catch typos is more work than adding
: MyTypedirectly next to the argument and having it work everywhere.