Python is the most popular programming language and beloved by many. However I can’t understand why (this is still the case in 2024).

Here are my main gripes with it:

  • It is slow, performance intensive tasks have to be offloaded to other languages, which makes it complicated to analyse. Moreover I wonder how many kwH could have been saved if programms were written in more performant languages. (and there are better alternatives out there)
  • The missing type system makes it easy to make errors, and the missing compiler makes it hard to catch them
  • It has no linear algebra built in, so you always have to convert things to numpy arrays, which is quite annoying
  • Managing virtual environments and pip packages feels overly complicated

I guess much comes down to personal, but I just can’t understand the love for python.

    • scharf_2x40@lemmy.worldOP
      link
      fedilink
      arrow-up
      3
      arrow-down
      1
      ·
      8 months ago

      Yeah, ofc every language must have a type system, the problem is, that this is not enforced. I.e 3 == ‘3’ throws no error, when working with dataframes for example this can be a pain in the ass. But yeah, I don’t say that nobody should use Python (although the title is a bit dramatic) I just think that there are better alternatives out there.

      • toasteecup@lemmy.world
        link
        fedilink
        arrow-up
        3
        arrow-down
        1
        ·
        8 months ago

        It’s not enforced because python like a number of other languages isn’t a strictly typed language. That decision was made by the creator of python and has been continued to this day, it wasn’t a part of their vision for python.

        I would suggest you consider using a different language since you obviously don’t care for python based on that complaints you’ve used that mirror complaints from every other person who “just doesn’t see the use of python”.

        Protip: I’m willing to bet that if your code is slow, it needs some refactoring. That or you could consider compiling your python into C code.

        • scharf_2x40@lemmy.worldOP
          link
          fedilink
          arrow-up
          2
          ·
          8 months ago

          Python is strongly typed, but dynamically checked. Working with other languages I just found, that the type errors in python are the hardest to catch and to debug, but maybe I am just more used to othet languages

          I see it’s use as language to write small scripts, I just don’t see much use besides that.

          Here is a article talking about the speed of compiled python vs Julia. I don’t see why it is better to go to all these extra steps just to end up with something slower. https://www.matecdev.com/posts/julia-python-numba-cython.html

          • toasteecup@lemmy.world
            link
            fedilink
            arrow-up
            1
            ·
            edit-2
            8 months ago

            I’d recommend a code formatter as well, it won’t improve code execution but it greatly improves readability which is a massive plus to me. I love black personally