• namingthingsiseasy@programming.devOP
    link
    fedilink
    arrow-up
    0
    ·
    1 month ago

    My opinion: Python may not be the best at everything it does, but it’s in the top 3-5 languages in the following areas:

    • Very easy to install, write and understand
    • Great libraries for a lot of applications
    • Large community, lots of people with experience in it

    It will always be a practical choice for those reasons. There are probably a lot more as well that I can’t think of at the moment.

    • masterspace@lemmy.ca
      link
      fedilink
      English
      arrow-up
      0
      ·
      1 month ago

      Python is popular because it’s whitespace based syntax make noobs think it’s easy to read. This and it’s pre-installation on Linux made it popular amongst academics who embraced it for data analysis. This lead to a lot of data scientists embracing it and writing libraries for it which created a virtuous cycle in that arena.

      And it’s a damn shame because Python, and it’s whitespace nonsense and lack of type system, is a horribly impractical language for building anything at scale.

        • masterspace@lemmy.ca
          link
          fedilink
          English
          arrow-up
          0
          ·
          1 month ago

          No, it’s not. It was rewritten in Facebook’s version of PHP when they bought them.

      • Eager Eagle@lemmy.world
        link
        fedilink
        English
        arrow-up
        0
        ·
        edit-2
        1 month ago

        It does make it easier to read. We primarily use indentation to match brackets, so clearly, indentation is the most important readability feature between the two, not brackets.

        Try reading the same piece of code: without brackets, and then without whitespaces and tell me which is better.

        Whitespaces as syntax force you to indent your code properly and not be misleading.

        • masterspace@lemmy.ca
          link
          fedilink
          English
          arrow-up
          0
          ·
          edit-2
          1 month ago

          I literally do that professionally, and I’m telling you that brackets are inarguably better.

          You are used to whitespace; I have literally spent months refactoring and upgrading a react frontend and a python backend and am telling you that brackets are a single character and far more predictable, and then your IDE / Linter / Formatter can reliably use them to fill in the perfect indentation and whitespace.

          My first professional language was Python, but I have since tried a half dozen others and would never choose to go back to a whitespace based language unless there was a good reason.

          • Eager Eagle@lemmy.world
            link
            fedilink
            English
            arrow-up
            0
            ·
            1 month ago

            I’ve written C, JS, PHP, and a few others. Today I write Python almost everyday and wouldn’t trade it for any of them. Maybe Rust, but not because of brackets.

      • flatbield@beehaw.org
        link
        fedilink
        English
        arrow-up
        0
        ·
        1 month ago

        Typing thing is way over blown. What did suck before Python 3 was indeterminate type result from the / operator. You never know if it would be integer or floating division looking at the code. Now it is floating.

    • Henson@feddit.dk
      link
      fedilink
      arrow-up
      0
      ·
      1 month ago

      I would add its a easy Scripting language. No compilation problem, richer that shell/bash makes it a powerfull choice.

      And a really dont like it.

      • flatbield@beehaw.org
        link
        fedilink
        English
        arrow-up
        0
        ·
        1 month ago

        It is far more then that. It is a full up programming language.

        I never understand why people think compilation is a barrier. But sure most python is not compiled.

        • Frezik@lemmy.blahaj.zone
          link
          fedilink
          English
          arrow-up
          0
          ·
          1 month ago

          Python is largely compiled. All the pieces of a compiler are built into how it processes things. Almost nothing works on an interpreter model anymore, where each line is parsed and executed before handling the next. Unix-style shell scripts are one of the very few exceptions. I believe JavaScript also starts being interpreted in the browser in order to start executing immediately, but then a compiled version is swapped into the runtime as soon as it’s ready.

          • flatbield@beehaw.org
            link
            fedilink
            English
            arrow-up
            0
            ·
            edit-2
            1 month ago

            Depends on what you mean by compiled. Python (CPython from python.org) typically translates to meta code and that is interpreted. True compilation to binary runs about 100x faster. Python is slow though there are faster versions and ways around it. Speed and threading are Python’s biggest issues.

            • Frezik@lemmy.blahaj.zone
              link
              fedilink
              English
              arrow-up
              0
              ·
              edit-2
              1 month ago

              I mean that there are successive steps to transform the entire code into tokens, the tokens into an AST, and the AST into some intermediary or final form.

              True compilation to binary runs about 100x faster.

              No, it doesn’t. Take a look at any of the number of projects that have attempted to compile Java to native code over the years. You’d be lucky to see any substantive gain at all. They sometimes have a use for packaging everything up in a single distributed binary, but you don’t do it for speed.

              Things like C and Rust are fast because the language semantics can be compiled in a fast way.