also I just realized that Brazil did NOT make a programming language entirely in Spanish and call it “Si” and that my professor was making a joke about C… god damn it

this post is probably too nieche but I feel like Lemmy is nerdy enough that enough people will get it lol

  • edinbruh@feddit.it
    link
    fedilink
    English
    arrow-up
    14
    arrow-down
    1
    ·
    2 months ago

    I’ll be honest, I think modern python is cool. You just need to accept that it has some limitations by design, but they mostly makes sense for its purpose.

    It’s true that the type system is optional, but it gets more and more expressive with every version, it’s honestly quite cool. I wish Pylance were a bit smarter though, it sometimes fails to infer sum types in if-else statements.

    After a couple large-ish personal projects I have concluded that the problem of python isn’t the language, but the users.

    On the other hand, C’s design is barren. Sure, it works, it does the thing, it gives you very low level control. But there is nothing of note in the design, if not some quirks of the specifications. Being devoid of innovation is its strength and weakness.

    • A_A@lemmy.world
      link
      fedilink
      arrow-up
      2
      ·
      2 months ago

      “The C programming language is like debating a philosopher and Python is like debating someone who ate an edible

      Here “edible” is a drug. it means Python is going in all and every directions like someone high on drugs.

      • anyhow2503@lemmy.world
        link
        fedilink
        arrow-up
        3
        ·
        2 months ago

        I get that part. I just don’t understand how the analogy relates to the programming languages. Maybe it really is just a shitty analogy from someone who doesn’t know much about either language.

  • Captain Aggravated@sh.itjust.works
    link
    fedilink
    English
    arrow-up
    7
    arrow-down
    1
    ·
    2 months ago

    Python is my “native” programming language, it’s the first I learned, and many of my leaps in understanding of the language have resulted from thinking “Wait, Python is a smart ass. I bet it can do…”

    • squaresinger@lemmy.world
      link
      fedilink
      arrow-up
      2
      ·
      edit-2
      2 months ago

      Python is 34 years old already. That means, someone who was already working as a programmer when Python came out would have to be about 54 years or older now.

      I wonder why people still think it’s the hot new thing.

      When Python came out, C was 19 years old. So Python is almost twice as old now as C was when Python came out.

      • normalexit@lemmy.world
        link
        fedilink
        arrow-up
        1
        ·
        2 months ago

        I was thinking more along the line of Goldilocks and the three bears. What is the language that feels just right to you (given the obvious issues with C and Python)

        • squaresinger@lemmy.world
          link
          fedilink
          arrow-up
          1
          ·
          2 months ago

          Makes sense what you are saying.

          When it comes to programming languages, I like to think of them as tools for a job. All languages have advantages and downsides.

          For server software Java is by far the best (especially if it’s supposed to scale). For web frontends it’s TypeScript. For very simple scripts that mostly call other tools it’s bash. For more complex scripts, non-performance-critical data processing and small projects it’s Python. For microcontroller work, C. For working on more performant microcontrollers C+Lua. For tests Groovy is surprisingly helpful. For game development GDScript or whatever your chosen environment supports.

          The rest is just syntax. It doesn’t really matter whether I use curly braces or indentation.

          I do like the old if-endif block style, but sadly that doesn’t really exist in mainstream languages anymore. Lua is the only thing that’s kinda similar, but they only use “end”, negating the advantage of being able to easier see where the “for” ends in a sea of “ifs”.

          I guess bash does something similar too, but “fi” and “esac” really break my fingers (and then they don’t even do “elihw”).

    • cooligula@sh.itjust.works
      link
      fedilink
      English
      arrow-up
      12
      ·
      2 months ago

      Why would you hate on it? It has its usecases. You won’t build an OS in Python, but I’d much rather do data processing in Python than in C

        • cooligula@sh.itjust.works
          link
          fedilink
          English
          arrow-up
          2
          ·
          2 months ago

          You just cannot do it, I’m afraid. Python is an interpreted language, and requires de CPython library to be translated into machine code so that it can then be run, but that requires an underlying OS that makes the calls. The closest thing would be micropython, which can be run inside the Linux kernel, but that’s about it. The only thing I can think of is using a custom compiler that would generate either C/C++ or assembly code from a Python script, and then compile it using a standard C/C++/assembly compiler.

          • buttnugget@lemmy.world
            link
            fedilink
            arrow-up
            1
            ·
            2 months ago

            Well shoot! This is really interesting though. I’m not a programmer, but I think I understand the basics of this.

      • PeriodicallyPedantic@lemmy.ca
        link
        fedilink
        arrow-up
        2
        ·
        2 months ago

        I hate on it mainly for its lack of static typing.
        I tried building a HomeAssistant add-on in python, and it was not a good experience. Idk what IDE python devs usually use but VSCode did not provide much assistance.

        • cooligula@sh.itjust.works
          link
          fedilink
          English
          arrow-up
          4
          ·
          2 months ago

          You can in fact statically type in Python. For example, defining variables:

          six: int = 6
          hello_world: str = "Hello World!"
          

          Or defining functions:

          def foo(x: int) -> int:
              return x**2
          

          If you only want to use static Python, you can use the mypy static checker:

          # Install mypy if you don’t have it
          pip install mypy
          
          # Run the checker on the file (e.g., example.py)
          mypy example.py
          
          • Kornblumenratte@feddit.org
            link
            fedilink
            arrow-up
            2
            ·
            2 months ago

            That’s just a fancy way of commenting on the intended types, no static typing though.

            Python will happily execute:

            six: int = 6
            six = "Hello World!"
            
          • PeriodicallyPedantic@lemmy.ca
            link
            fedilink
            arrow-up
            1
            ·
            2 months ago

            I was using that syntax, but nothing seemed to be checking it. Running an external app to get static checking done isn’t great, presumably there are extensions for common IDEs?

            But the poor vscode developer experience went beyond that. I attribute it to dynamic typing because most of my frustration was with the IDE’s inability to tell me the type of a given variable, and what functions/properties were accessable on it.

            I hope it’d be better on an IDE made specifically for python, although idk how many extensions I’d have to give up for it, and things like devcontainers.

          • Omgpwnies@lemmy.world
            link
            fedilink
            English
            arrow-up
            1
            ·
            2 months ago

            What you’re describing is type hints, it’s syntactic sugar and not used at all by the interpreter.

            For example, this is a “legal” statement:

            foo: int = "bar"

            Your IDE and linter will complain, but the interpreter just chops the hints off when compiling, and it’s left with foo = "bar"

        • buttnugget@lemmy.world
          link
          fedilink
          arrow-up
          2
          ·
          2 months ago

          I am currently taking a Python class and we are using PyCharm I’m not a developer, so I don’t know if it’s good yet.

    • QuinnyCoded@sh.itjust.worksOP
      link
      fedilink
      arrow-up
      2
      arrow-down
      1
      ·
      edit-2
      2 months ago

      i didn’t say anything negative about it, I like both languages (though python is way easier). i was just stoned and made an observation

  • hardcoreufo@lemmy.world
    link
    fedilink
    arrow-up
    6
    arrow-down
    1
    ·
    2 months ago

    I try to avoid python for two main reasons. While coding, white spaces. Who thought that was a good idea? While using, shared dependancies, again who thought thay was a good idea? I have to use pipx or manually make a venv otherwise python scripts start breaking each other. May as well just package it with its own dependancies from the get go.

  • Treczoks@lemmy.world
    link
    fedilink
    arrow-up
    3
    ·
    2 months ago

    also I just realized that Brazil did NOT make a programming language entirely in Spanish and call it “Si”

    Imagine Python did this, and people would programming in Dutch!