Everytime I have to use some python script I fucking groan. God, what a pain in the ass python is...

  • ButtBidet [he/him]
    ·
    2 years ago

    :downbear:

    • No curly brackets

    • No semi-colons

    • No need to declare variables

    • There's 8 trillion useful and free libraries

    • It's all open source

    • Passing arguments in function calls is so much easier

    • Classes are painless

    DON'T YOU DARE INSULT MY PYTHON YOU LIBERAL

    • captcha [any]
      ·
      2 years ago
      • aesthetics
      • aesthetics
      • defect
      • JavaScript does the same with better package management.
      • same with much other languages, JavaScript, cargo, rust, go, etc.
      • in what languages is this a problem?
      • worst class implementation still in use (close second, C++)
      • ButtBidet [he/him]
        ·
        2 years ago

        Try typing your umpteenth semi colon and curly brackets. That shit ain't aesthetics, it's miserable.

        Javascript is owned by Oracle. Go is made by Google. I release that they're both open source, but it's rad that we have a language that's on board with the free software movement, and that's created and maintained by volunteers.

        Passing arguments in static typed language are a pain 😩

        • captcha [any]
          ·
          edit-2
          2 years ago

          If avoiding typing extra characters is high on your list of priorities for a language then you need more experience programming. Higher priorities should revolve around ensuring the code you write works.

          JavaScript is not owned by Oracle, that's Java, which has nothing to do with JavaScript besides curly braces. JavaScript has no license. There is a public reference spec and various (sometimes conflicting) implentations of an interpreter.

          Despite official releases of java being proprietary, there are always compatible releases of OpenJDk which are GPLv2

          Google doesn't own Go either, some ex-google engineers did start it but its BSD license.

          Passing arguments in static typed language are a pain 😩

          :warf-wtf: are you using different types for the same arguements? This is a first class way to break your program. Good python development is constantly manually checking for programmer error as though it was user error. Static languages just do that for you.

          • blue_lives_murder [they/them]
            ·
            2 years ago

            Google doesn’t own Go either, some ex-google engineers did start it but its BSD license.

            in practice google effectively owns go. the language is still rapidly changing and none of those changes happen unless google's ok with it

          • ButtBidet [he/him]
            ·
            2 years ago

            Passing arrays inside C type languages is horrible. Other users already responded to the ownership issue. Honestly I'm just pretending to be mad because I want to see programming struggle session. But obviously I don't want to actually upset anyone.

            • macabrett
              ·
              2 years ago

              Passing arrays inside C type languages is horrible.

              I don't understand this one. C# is one of the most popular C type languages, and there's nothing weird about passing arrays?

              • captcha [any]
                ·
                2 years ago

                Thats because C# is only a "C-type" language in name and curly braces. In reality its just Microsoft Java.

                • macabrett
                  ·
                  2 years ago

                  Is Java not also a C derivative?

                  • thisismyrealname [he/him]
                    ·
                    edit-2
                    2 years ago

                    not really no. the syntax is similar, but it has more in common with C++ than C.

                    i sort of agree with @ButtBidet on C specifically, where arrays are essentially just syntactic sugar for memory pointers.

                    • macabrett
                      ·
                      2 years ago

                      Sure, I specifically hate writing in C and have no issue saying sending arrays around in C isn't fun. I took "C type languages" as anything in the very specific C++ lineage, considering the very first complaint in this conversation was about semi-colons and brackets. Like, what's a "C type" language even mean if the only option is "C"? I was simply pointing out complaining about passing arrays around in a "C type language" is a weird complaint as your reason for using primarily python as there are a mountain of languages between "Python or C" that don't have that issue.

                  • captcha [any]
                    ·
                    2 years ago

                    If all you care about is the syntax then yes. But java is so fundamentally different under the hood than C that I would call it its own thing. Like it's hardwired to be OOP, you dont do any manual memory management, and its compiled to run on a special VM. I would say that's wildly different from C.

                    Its like how JavaScript is meant to look like Java but its really far more like LISP under the hood.

                    • macabrett
                      ·
                      2 years ago

                      but we're in a thread talking very specifically about syntax...

                      • captcha [any]
                        ·
                        2 years ago

                        Passing arrays in C isn't hard because of the syntax. Its hard because of how C handles memory. C# and Java are designed to be memory safe so they dont have that problem.

        • PapaEmeritusIII [any]
          ·
          2 years ago

          It’s really not that bad once you’re used to it. If you’re coding for fun, I see how it’d be a pain, but when you’re coding 8hrs a day it quickly becomes second nature

        • macabrett
          ·
          edit-2
          2 years ago

          Try typing your umpteenth semi colon and curly brackets. That shit ain’t aesthetics, it’s miserable.

          Why do you use punctuation in your sentences?

          edit: I should clarify my point. I think the thing that makes python easy to write (uses whitespace as opposed to semi-colons and curly brackets) makes it considerably harder to quickly read. Those symbols mean things and it means your brain can make quick assumptions as you're reviewing code. Which is also a useful facet of punctuation in written language.

        • buh [she/her]
          ·
          2 years ago

          Javascript is owned by Oracle

          are you confusing it with Java?

          • ButtBidet [he/him]
            ·
            edit-2
            2 years ago

            "Javascript" trademark

            Edit: feck please just scroll down to the "Trademark" heading, my link didn't work fully

            I realise​ that it's a lot more complicated than "Sun Microsystems made Javascript", but it's nice having a programming language that's in the middle of the free software movement.

        • userse31 [he/him]
          hexagon
          ·
          2 years ago

          Passing arguments in static typed language are a pain 😩

          I've written some C in my time and no, no it isn't.

      • ButtBidet [he/him]
        ·
        2 years ago

        Ya cuz Haskell is so damn easy that most programmers prefer it.

        • silent_water [she/her]
          ·
          2 years ago

          there's been some experiments teaching it to children - it's about as easy as python but it's a completely different way of thinking. in some ways, it's easiest to learn if you haven't been introduced to an imperative language already. I'd say they were two totally different skillsets except that you write radically different code in imperative languages that allow for higher-order functions after you've learned Haskell.

      • ButtBidet [he/him]
        ·
        2 years ago

        Back in my day we wrote everything in machine language. Want a variable? Fuck you. Want a for loop? Fuck you. Want to move your code to a different CPU? Fuck you in all holes simultaneously.

        • yoink [she/her]
          ·
          2 years ago

          kiddo i've shit out punchcards that are bigger than you, hoooeyy

    • PapaEmeritusIII [any]
      ·
      edit-2
      2 years ago

      I mainly code in C/C++ these days, for work reasons

      I can’t stand python anymore. It’s so presumptuous!!! Give me more control over what’s going on under the hood!!! aaaaaaaa

      (I am drunk)

        • PapaEmeritusIII [any]
          ·
          2 years ago

          Oh, yeah, absolutely do what brings you joy. I won’t argue with that. The one time that I programmed for fun in the past two years, I did it with python because it was easy to set up and get going. I’d just never want to use it for the bulk of what I do for serious work.

          If you ever want to give C another try, this (online, fully free) book has a great introduction to it, with python comparisons: https://diveintosystems.org/book/

    • crime [she/her, any]
      ·
      2 years ago

      Just use Ruby, it does just about everything python does and then some, but the package management works and you don't have to struggle against load-bearing whitespace the whole time

  • crime [she/her, any]
    ·
    2 years ago

    Amen. Python package management is ass, made worse by the python 2.7 vs python 3. I'm sure it doesn't help that because it's pushed on beginners, a ton of python projects are set up by people who don't have any idea what they're doing.

    My least favorite part of reading and writing python has to be semantic meaning for indentation. If I wanna comment out the start of a loop to test something and not fully reformat my entire project that's my business.

    • PorkrollPosadist [he/him, they/them]
      ·
      edit-2
      2 years ago

      I’m sure it doesn’t help that because it’s pushed on beginners, a ton of python projects are set up by people who don’t have any idea what they’re doing.

      Holy shit! Is this it? Is this why Python (and Javascript in particular) are hell?

      edit: (in defense of Python, Gentoo's package manager, Portage, is programmed in Python and is the most robust package manager I've ever used in a good 20 years)

      • DefinitelyNotAPhone [he/him]
        ·
        2 years ago

        Yes. It's where all the people who don't yet know what they're doing end up, and 80% of the world is built on it, so the end result is everything is dogshit.

      • captcha [any]
        ·
        2 years ago

        So is Arch's pacman last I checked but they monitor its codebase with an iron fist. Python has a useful niche right above complicated shell scripts. It just keeps getting applied outside of its domain.

    • userse31 [he/him]
      hexagon
      ·
      2 years ago

      THIS IS LITERALLY WHAT I HAD TO DEAL WITH LAST NIGHT!

      Some bluetooth exploit code written in python 2.7, AFTER 2014 WHEN THE PEOPLE AT PYTHON SAID TO STOP USING 2.7!!!

      And then the giant fucking MESS trying to get the correct pissing versions of pip packages installed. Fuck it!

    • captcha [any]
      ·
      2 years ago

      Holy shit I hate python tooling so much. I jump at every new possible package manager for python but find out that its still shit because of PyPI. Pretty sure the only reliable way to test python code is to always run it in docker images.

        • captcha [any]
          ·
          2 years ago

          Docker is good actually as it can effectively quarantine terrible build systems and spares your machine from global dependency installs just to test out some code. Its just something new you need to learn like git.

          only does C, C++, and Go

          How does this spare you from docker? All these languages have terrible if existent build systems.

          • alexandra_kollontai [she/her]
            ·
            2 years ago

            Concepts of docker are good, its tooling is shit especially for hobbyists. I've found it works much better for corporate stuff than for individuals.

            • Sinonatrix [comrade/them]
              ·
              2 years ago

              Idk if related abstractions like Toolbox (as used in Fedora Silverblue) are totally ready, but they seem like interesting progress for lowering the barrier of entry to paravirtualize builds

              • alexandra_kollontai [she/her]
                ·
                2 years ago

                I've used toolbox and it doesn't seem like it's possible to package up a "system state" and distribute that as your application.

                Toolbox is just a wrapper over podman (which copies the docker cli api) anyway.

                • Sinonatrix [comrade/them]
                  ·
                  2 years ago

                  I don't think deployment is intended, just making it easier for the developer to isolate dependencies they need.

            • captcha [any]
              ·
              2 years ago

              Go's build system was good when it first came out but everything has gotten wildly better since. Rust's cargo at the moment is the gold standard AFAIK. The main issue with go's build system was $GOPATH. Go would insist on installing all dependencies globally onto the GOPATH. Meaning, if I was working on two different projects using different versions of the same dependency I would have to maintain an entirely separate GOPATH. Maybe go has stopped doing that recently but that's what I last saw.

              Most build systems now allow dependency versioning per project by default and if they're good will cache builds of the same version between projects.

              I'm mostly upset because if I dont have a GOPATh set and I install a go project from source it will make a ~/go folder without asking me.

                • captcha [any]
                  ·
                  2 years ago

                  oh thank god, I've been scared to get back into go because of it.

                  If you like C, C++ and Go then you'll like Rust as its a better attempt to dethrone C than Go was. The basic types, struct, enum, and trait are the most elegant and least burdensome system I've seen yet. But that borrow checker though really can be an obstacle. Everything must be safe. It can get really weird when doing async stuff but your getting safe async code for a lot easier than other languages.

                  • PissPoorGrandpig [none/use name]
                    ·
                    2 years ago

                    I adore Rust. The borrow checker can be a pain, but ~95% of the time you can simply read the compilation error and it will tell you exactly how to fix the problem. I think I had more issue with lifetimes at first, when I was trying to add too much state to my structs, but even that only takes a couple of weeks of hobby programming to learn really.

                    I'd love to get a job writing rust instead of stupid php like my current job :sadness:

                      • PissPoorGrandpig [none/use name]
                        ·
                        2 years ago

                        it's much better than it used to be, but it's still not great. We enforce strong typing with phpstan static analysis, use enums everywhere (no magic strings), use a decent ORM w/ functional collection syntax, use proper SOLID principles, full test coverage, have everything in decent CI etc., so in general it's a passable language at this point. Slow, but passable.

            • userse31 [he/him]
              hexagon
              ·
              2 years ago

              As someone who codes in javascript, your 100% correct.

      • crime [she/her, any]
        ·
        2 years ago

        Yup. I've found that Poetry is decent as far as python package management goes (takes a lot of cues from ruby's bundler, which imo is the gold standard for package managers) but like you said it still suffers from pypi issues

        • captcha [any]
          ·
          2 years ago

          I moved from pipenv to poetry only to find it marginally better. It will still stall out if you try to install too many things and PyPI tells you to fuck off like pipenv did. pdm is the current train I'm on as it hasn't stalled out on me yet but in time I'm sure it will.

      • Sinonatrix [comrade/them]
        ·
        2 years ago

        I haven't done anything very intricate in python, but is the built-in virtual environment not enough to lock dependencies? I'd probably rather docker for a serious project, but venv takes way less infrastructure.

        • captcha [any]
          ·
          2 years ago

          The problem comes from PyPI and resolving dependencies of your dependencies. I dont fully understand it but it sounds like PyPI has to execute code from your dependency to determine its dependencies and sometimes that process will stall out. Also if you're resolving some sort of dependency hell and constantly doing poetry install PyPI might block you.

      • ButtBidet [he/him]
        ·
        2 years ago

        The newer versions of Pycharm have improved it a lot. Granted Pycharm had iffy package installing until quite recently.

    • ppb [none/use name]
      ·
      2 years ago

      I believe you are overlooking one of the most important aspects of a programming language, how easy it is for randos to make hello worlds. :very-smart:

  • captcha [any]
    ·
    2 years ago

    Python is fine when used correctly. The problem is it's never used correctly. You're only ever supposed to use it to download data from some external source and process it. Or maybe write a one off script that has no dependencies. Webserver? GUI application? anything meant to scale? Orchestrating all your kubernetes jobs? Please stop.

    The smartest thing Ansible did is replace what would be tomes of python code with a bunch of yaml. Even though its all python under the hood, people are writing less python and that's for the best.

    def counter():
        counter.value += 1
        return counter.value
    
    
    counter.value = 0
    
    print(counter()) # 1
    print(counter()) # 2
    print(counter()) # 3
    

    Insane language.

      • yoink [she/her]
        ·
        edit-2
        2 years ago

        literally this, as well as calling the function with every print instead of calling the variable they're after directly unless i'm missing something entirely

        • captcha [any]
          ·
          2 years ago

          Being able to externally mutate the internals of a function is bad and shouldn't be allowed in a language.

      • captcha [any]
        ·
        2 years ago

        The point of my example is this shouldn't be possible. Local static variables shouldnt be publically available globally. (Local static variables shouldn't exist ever fwiw).

        Python is one of those languages where you'll be fine as long as you never use 95% of its features.

    • makotech222 [he/him]
      ·
      2 years ago

      If no one is ever using it correctly, then you can assert that the language guides you to make those bad choices. Its a bad language in that case.

  • thisismyrealname [he/him]
    ·
    2 years ago

    python, aka "oops you installed something with dependencies using pip and now your distro will never be able to install a python package again"

    that may be Arch's fault, but it feels better to blame it on python

    • userse31 [he/him]
      hexagon
      ·
      2 years ago

      Oh my god I had to deal with pip yesterday.

      Ended up uninstalling it. Fuck that!

    • PorkrollPosadist [he/him, they/them]
      ·
      2 years ago

      It was written in Delphi in the early 2000s and I had to go through so much shit to track down the free version of certain Borland tools just to compile it.

      You'd literally be better off if it were programmed in COBOL.

  • Sinonatrix [comrade/them]
    ·
    2 years ago

    Me writing a fun script to do a task: wow cool

    Me reading a fancy research paper with inline Python: wow cool

    Me downloading someone's fun script that turned into a hulking pyinstaller monstrosity: oh no

    Still better than Perl, but some people really do just need to learn another language

  • BabaIsPissed [he/him]
    ·
    2 years ago

    I think it's a neat little language for ML/DS and general scientific shenanigans, since it's concise and notebooks are a didactic way to display code. Save your rage for languages with 0 redeeming qualities, like fucking javascript.

    • userse31 [he/him]
      hexagon
      ·
      2 years ago

      Oh don't worry, javascript pisses me off too.

  • Lerios [hy/hym]
    ·
    2 years ago

    aside from the indentation, which i know is kind of annoying but you get used to it, whats wrong with it? python (and matlab i guess) is the only language that was taught in my degree, and it seems fine?

    • PapaEmeritusIII [any]
      ·
      2 years ago

      As a (currently drunk) programmer. I think the most annoying thing about python is that it encourages people to write things in “pythonic” ways (read: using really esoteric python features to do complex operations in as few lines as possible).

      When you don’t primarily work with python, it makes it unnecessarily difficult to read people’s “pythonic” code.