• witx@lemmy.sdf.org
      link
      fedilink
      arrow-up
      29
      ·
      1 year ago

      I don’t mean it doesn’t work for larger projects. Just that it’s a pain to understand other’s code when you have almost no type information, making it, to me, a no go for that

      • fhoekstra@programming.dev
        link
        fedilink
        arrow-up
        10
        arrow-down
        2
        ·
        edit-2
        1 year ago

        Larger projects in Python (like homeassistant) tend to use type-hints and enforce them through linters. Essentially, these linters (with a well-setup IDE) turn programming in large Python projects into a very similar experience to programming a statically typed language, except that Python does not need to be compiled (and type-checked) to run it. So you can still run it before you have satisfied the linters, you just can’t commit or push or whatever (depending on project setup).

        And yes, these linters and the Python type system are obviously not as good as something like a Go or Rust compiler. But then again, Python is a generalist language: it can do everything, but excels at nothing.

        • nous@programming.dev
          link
          fedilink
          English
          arrow-up
          8
          ·
          1 year ago

          Go and rust are also generalist languages. Basically all main stream programming languages are and are equally as powerful (in terms of what they can do, rather than performance) as each other as they are all Turing complete. So you can emulate c in python or python in c for instance).

          Anything you can do in python you can do in basically any other mainstream language. Python is better at some niches than others just like all other languages are with their own niches - and all can be used generally for anything. Python has a lot of libraries that can make it easier to do a large range of things than a lot of other languages - but really so do quite a few of the popular languages these days.

          • fkn@lemmy.world
            link
            fedilink
            arrow-up
            1
            arrow-down
            1
            ·
            1 year ago

            Not that you are wrong, but it was super weird to read that “python can be emulated in c”.

            I mean yes… But…

        • witx@lemmy.sdf.org
          link
          fedilink
          arrow-up
          3
          ·
          1 year ago

          That’s actually a good idea, enforcing it. Still, do these linters protect against misuse? E.g I have an int but place a string on it somewhere?

          • sirdorius@programming.dev
            link
            fedilink
            arrow-up
            5
            arrow-down
            1
            ·
            edit-2
            1 year ago

            Yes, in a good dev workflow mypy errors will not pass basic CI tests to get merged. Types are not really a problem in modern Python workflows, you can basically have a better type checker than Java out of the box (which can be improved with static analysis tools). The biggest problem with Python remains performance.

      • Alfiegerner@lemm.ee
        link
        fedilink
        arrow-up
        2
        ·
        1 year ago

        Fair enough, I don’t notice a significant overhead but then a lot of information is inferred by patterns , project structures etc etc