Have to add that we work exclusively in strongly-typed languages. Kinda want to see how it plays out, but I can’t help but argue with him, so I think I’ll just go.

  • xmunk@sh.itjust.works
    link
    fedilink
    arrow-up
    10
    arrow-down
    1
    ·
    2 days ago

    … and yet… it lacks clear and enforced type restrictions which help with clear code contracts. It’s certainly better than Javascript but the lack of runtime enforced type checking can force defensive programming in an unnecessary manner.

    Your statement isn’t strict type checking. It’s a restricted form of type coercion. Given how common this feature is in other languages it’s weird that pythonistas feel so defensive when discussing the feature. I enjoy strict type checking, but that’s my opinion - it makes it a poor choice for the sorts of projects I work on but if it’s good for you then enjoy!

    • Kache@lemm.ee
      link
      fedilink
      arrow-up
      2
      ·
      1 day ago

      it lacks clear and enforced type restrictions which help with clear code contracts

      Not anymore! Gradual typing is supported by the core language and pyright is a fantastic incremental type checker that you can use both in your editor and in CI.

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

      You said it’s not runtime type checking but then switched to “strict type checking” - those aren’t the same. Other person has it right, it has runtime type checking. The type checking happens when running your code. I don’t think that’s particularly useful, it’s pretty much sugar on top of what would throw an error anyway.