4 ms·
Fake typing in python was a terrible idea I can't believe got merged in. The initial version where you had to import new typing classes was particularly ugly. N
by jwmoz 3y ago
Fake typing in python was a terrible idea I can't believe got merged in. The initial version where you had to import new typing classes was particularly ugly. Now it is mitigated somewhat with as you would expect builtin type hints.
The worst thing for me is I have to work with javascript devs that can also do python and they incessantly use python type hinting because they come from typescript.
It's useless, clutters up the code and decreases readability.
- qayxc 3y agoFunny. I have the exact opposite experience. Type hints tell me what the code actually does and what kind of arguments functions and methods actually expect. It's all sunshine and rainbows if you work with well documented libraries, but there are tons of python libs out there that just use *kwargs as their function signatures with maybe - if you're lucky - a list of actual keywords (no types or description though). Those are hell to work with, because the IDE can't tell you what's going on. So you either have to delve into sample code (and hope that's still up-to-date) or look at the source code to figure out what the heck is going on. So no, I personally don't find type hints useless at all - especially for libraries. Readability OTOH is subjective and mostly just a matter of what you're used to, anyway.
- smitty1e 3y ago> It's useless, clutters up the code and decreases readability. I submit that dataclasses refute these claims handily.