5 ms·
Is there any study that shows that typing in Python improves code quality and reduce runtime issues?
by sails01 9mo ago
Is there any study that shows that typing in Python improves code quality and reduce runtime issues?
- hexo 9mo agoWell, it's just a documentation suggestion for user. Having for me about same value as if it was written in pydoc. I'd really love to see such study as well
- sails01 9mo agoAgree, we already had a solution documenting types in docstring. In my case they just add noise when reading code and make it more difficult to review
- bmitc 9mo agoThat's equivalent to asking if there are benefits of static typing.
- sails01 9mo agoNot quite, static typing is used at runtime, python type annotations are not
- amethyst 9mo agotools like dataclasses and pydantic would like to have a word...
- dragonwriter 9mo ago> Not quite, static typing is used at runtime, python type annotations are not No, static typing is usually used AOT (most frequently at compile time), not usually at runtime (types may or may not exist at runtime; they don't in Haskell, for instance.) Python type checking is also AOT, but (unlike where it is inextricably tied to compilation because types are not only checked but used for code generation) it is optional to actually do that step. Python type annotations exist and are sometimes used at runtime, but not usually at that point for type checking in the usual sense.
- tome 9mo ago> > Not quite, static typing is used at runtime, python type annotations are not > No, static typing is usually used AOT (most frequently at compile time), not usually at runtime (types may or may not exist at runtime; they don't in Haskell, for instance.) In fact, Haskell then allows you to add back in runtime types using Typeable! https://hackage.haskell.org/package/base-4.21.0.0/docs/Data-Typeable.html https://hackage.haskell.org/package/base-4.21.0.0/docs/Data-...
- wiseowise 9mo ago> static typing is used at runtime Educate yourself before making such claims.
- pansa2 9mo agoSpecifically, it's like asking if there are any studies that demonstrate benefits of static typing. Are there?
- kurtis_reed 9mo agoNewsflash: not everything good has a study about it
- wiseowise 9mo ago> Ughm, is there any study that shows that guardrails and lights on bridges reduce fatalities? > Akshually, are there any studies showing that cars riding 30 km/h kill less people than cars that ride 80 km/h?
- dllthomas 9mo agoI think there are both of those.
- solarkraft 9mo agoit has been consensus for decades at this point.