3 ms·
Is there any study that shows that typing in Python improves code quality and reduce runtime issues?
by sails01 10mo ago
Is there any study that shows that typing in Python improves code quality and reduce runtime issues?
- hexo 10mo 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 10mo 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 10mo agoThat's equivalent to asking if there are benefits of static typing.
- sails01 10mo agoNot quite, static typing is used at runtime, python type annotations are not
- amethyst 10mo agotools like dataclasses and pydantic would like to have a word...
- dragonwriter 10mo 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 10mo 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 10mo ago> static typing is used at runtime Educate yourself before making such claims.
- pansa2 10mo agoSpecifically, it's like asking if there are any studies that demonstrate benefits of static typing. Are there?
- kurtis_reed 10mo agoNewsflash: not everything good has a study about it
- wiseowise 10mo 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 10mo agoI think there are both of those.
- solarkraft 10mo agoit has been consensus for decades at this point.