• namingthingsiseasy@programming.devOP
    link
    fedilink
    arrow-up
    3
    arrow-down
    1
    ·
    2 days ago

    Python’s type system is dramatically better than Javascript’s though. Try doing things like '' + True and Javascript will do incredibly stupid things. Python will just give you a type error. Also, look at things like == vs === in Javascript as well. That’s the biggest reason why Typescript replaced it overnight. Python has found a better balance between productivity and error safety.

    In my opinion, the biggest shortcoming of Python’s dynamic typing system is that you need to have very thorough test coverage to be sure that your code doesn’t have semantic errors (a lot more than, say, Java). It has gotten better with the introduction of type hints, those I don’t have much experience with them, so I can’t say how much.

    • Feyd@programming.dev
      link
      fedilink
      arrow-up
      2
      ·
      2 days ago

      In my opinion, the biggest shortcoming of Python’s dynamic typing system is that you need to have very thorough test coverage to be sure that your code doesn’t have semantic errors

      That is a large shortcoming.

      • namingthingsiseasy@programming.devOP
        link
        fedilink
        arrow-up
        2
        arrow-down
        2
        ·
        2 days ago

        Sure, but as with all things, it can depend on a lot of factors. All code needs some degree of testing, though one could certainly argue that Python needs more than Java and Java needs more than Rust/Haskell/etc. So you could argue that the productivity gain of using Python is offset by the productivity loss of extra testing. It’s still hard to say which one wins out in the end.

        • Feyd@programming.dev
          link
          fedilink
          arrow-up
          5
          ·
          edit-2
          2 days ago

          People underestimate the cost of testing.

          1. It has to actually happen to be effective and is something that can be dropped under time pressure where something built into the language cannot.
          2. Test code is also code that is not guaranteed to be correct, and also incurs it’s own maintenance tolls

          Removing the need for entire classes of tests cases is a huge win