• masterspace@lemmy.ca
    link
    fedilink
    English
    arrow-up
    14
    arrow-down
    18
    ·
    2 days 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.

    • flatbield@beehaw.org
      link
      fedilink
      English
      arrow-up
      6
      arrow-down
      1
      ·
      edit-2
      1 day ago

      White space nonsense. Yes and no. I do not enjoy tracking down white space issues until I remember the alternative. Matching brackets, writing begin/end statements, and worst of all looking at code that appears well indented until later you find it is not. and it runs totally differently then it looks. Similar issues with semicolons.

      Pretty much everyone uses LSEs these days so frankly matters less either way most of the time.

    • Eager Eagle@lemmy.world
      link
      fedilink
      English
      arrow-up
      4
      arrow-down
      2
      ·
      edit-2
      1 day 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.

      • shoo@lemmy.world
        link
        fedilink
        arrow-up
        1
        ·
        16 hours ago

        Brackets are infinitely easier because any IDE (and most text editors) have a dead simple linting plugin which auto indents for you and lets you know when you fucked up. Your editor can barely do anything with whitespace only because everything is valid syntax.

        Also lemme take this opportunity to say fuck yaml for exactly this reason.

      • masterspace@lemmy.ca
        link
        fedilink
        English
        arrow-up
        4
        arrow-down
        3
        ·
        edit-2
        24 hours 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
          1
          arrow-down
          1
          ·
          23 hours 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
      3
      arrow-down
      2
      ·
      1 day 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.

      • masterspace@lemmy.ca
        link
        fedilink
        English
        arrow-up
        11
        arrow-down
        1
        ·
        edit-2
        2 days ago

        Or you know, TypeScript, Go, C#, Java, Swift, etc. etc.

        Python isn’t great at anything except for having a lot of data science libraries already written for it.

        • Valmond@lemmy.world
          link
          fedilink
          arrow-up
          4
          arrow-down
          2
          ·
          edit-2
          1 day ago

          Not only data science libraries, there is a library for about anything. Which is not the case for your list of languages.

          Edit: not all languages in the list.

          When you understand how python works, it’s quite simple to use too, and has lot less clutter than say java or c#.

          • atzanteol@sh.itjust.works
            link
            fedilink
            English
            arrow-up
            7
            ·
            2 days ago

            Not only data science libraries, there is a library for about anything. Which is not the case for your list of languages.

            Java has an excellent ecosystem for libraries. And a much more mature one in most cases than Python. The Spring framework alone is simply amazing.

            Go’s ecosystem is pretty good as well and getting better.

            When you understand how python works, it’s quite simple to use too, and has lot less clutter than say java or c#.

            The problem is that many python devs consider things like “type hints” and “classes” to be “clutter”. It takes a lot of discipline to write managable python. Being “newb friendly” is a curse. “stringly typed” crap does NOT scale well.

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

        It can scale though. It parallelizes really well if you use queuing systems to distribute the load. You just have to make sure that the hot loops are in C/C++, and it is very easy to interface with compiled binaries via the C API.

        • atzanteol@sh.itjust.works
          link
          fedilink
          English
          arrow-up
          6
          arrow-down
          1
          ·
          2 days ago

          It can scale though.

          So can assembly. But it takes a tremendous amount of discipline.

          Python’s curse is that it’s popular with “newbs” who think it’s okay to use dictionaries for everything and that type hints are “clutter”.

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

            Agreed. I have seen a lot of Python code that was really painful to massage back into a more structured object hierarchy. Java certainly does a bit better in that respect, and as a language, it does a much better job of encouraging better practices, but I think it’s also largely due to the kinds of people that use those languages as well.