• oce 🐆@jlai.lu
    link
    fedilink
    arrow-up
    2
    ·
    edit-2
    16 days ago

    Some people think that because Python is the easiest language to learn, it’s going to be easy to learn programming with Python. But learning programming is still very hard, so many abstract concepts to grasp. Python just makes it a tiny less hard, almost insignificantly now that we can use an LLM to learn the syntax faster than than ever.

    • AnAmericanPotato@programming.dev
      link
      fedilink
      English
      arrow-up
      2
      ·
      16 days ago

      In practice, Python is not easy to learn programming with. Not at all. I see beginners wrestling with Anaconda and Jupyter notebooks and I weep.

      The fact that pip is intentionally broken on macOS and some modern Linux distros sure doesn’t help. Everything about environment management is insane.

      • tyler@programming.dev
        link
        fedilink
        arrow-up
        1
        ·
        16 days ago

        Comparing python env management to Ruby or rust or even Java for fucks sake just goes to show that nobody actually cares about how easy a language is to use, they just care about what is popular or what they think is popular.

        • oldfart@lemm.ee
          link
          fedilink
          arrow-up
          0
          ·
          16 days ago

          Ruby, of all the examples you could come up with? My Redmine is updated only every few years because I rarely have a whole day to deal with the mess that is Ruby deps managent.

          Java deals with this ellegantly.

          • tyler@programming.dev
            link
            fedilink
            arrow-up
            0
            ·
            14 days ago

            Huh? I assume you mean RubyMine and I have no clue what dependency issues you could be dealing with unless you’re on windows (which python is even worse with). You have one package manager and one build tool on Ruby, compared to Python’s now 16 tools. Ruby is the gold star for package management which is why both Rust and Elixir copied enormous parts of it when creating their tools cargo and mix.

            • oldfart@lemm.ee
              link
              fedilink
              arrow-up
              0
              ·
              14 days ago

              https://www.redmine.org/ is a standard rails webapp. Nothing special. Straightforward to update, just a few commands, the only quirk is that at least one step always fails. Some obscure bug in a dependency, some problem with expected vs installed system libraries, or my favourite, a Segmentation Fault.

              • tyler@programming.dev
                link
                fedilink
                arrow-up
                0
                ·
                13 days ago

                Conflating a Ruby on Rails app to all of Ruby is just not really fair. It’s like comparing Lombok to Java. Lombok is a hot fucking mess and Java app with it is gonna have difficulty at later points.

                Aside from that (I think rails is honestly terrible), just looking at the repo I can see that RedMine doesn’t use bundler, which is the singular standard in the Ruby community, so it’s like saying “a project I use uses Ant under the hood so Java is bad”. Like I said, there’s a reason that Rust and Elixir based their build tools off of Ruby’s.

                • oldfart@lemm.ee
                  link
                  fedilink
                  arrow-up
                  0
                  ·
                  12 days ago

                  I haven’t had any problems with redmine itself but with dependencies and the Ruby runtime.

                  And if you’re saying I don’t have enough experience to make claims about Ruby dep management, I can say the same about you Python. Works flawlessly for me.

  • demesisx@infosec.pub
    link
    fedilink
    English
    arrow-up
    1
    ·
    16 days ago

    This is why I decided to learn Nix. I built dev environment flakes that provision the devshell for any language I intend to use. I actually won’t even bother unless I can get something working reliably with Nix. ;)

    For example, here’s a flake that I use for my Python dev environment to provide all needed wiring and setup for an interactive Python web scraper I built:

    
    {
      description = "Interactive Web Scraper";
    
      inputs = {
        nixpkgs.url = "github:NixOS/nixpkgs?ref=nixpkgs-unstable";
        utils.url = "github:numtide/flake-utils";
      };
    
      outputs = { self, nixpkgs, utils }: utils.lib.eachSystem ["x86_64-linux"] (system: let
        pkgs = import nixpkgs { system = system; };
      in rec {
        packages = {
          pyinputplus = pkgs.python3Packages.buildPythonPackage rec {
            pname = "pyinputplus";
            version = "0.2.12";
            src = pkgs.fetchPypi {
              inherit pname version;
              sha256 = "sha256-YOUR_SHA256_HASH_HERE";
            };
          };
    
          pythonEnv =
            pkgs.python3.withPackages (ps: with ps; [ webdriver-manager openpyxl pandas requests beautifulsoup4 websocket-client selenium packages.pyinputplus ]);
        };
    
        devShell = pkgs.mkShell {
          buildInputs = [
            pkgs.chromium
            pkgs.undetected-chromedriver
            packages.pythonEnv
          ];
    
          shellHook = ''
            export PATH=${pkgs.chromium}/bin:${pkgs.undetected-chromedriver}/bin:$PATH
          '';
        };
      });
    }
    
    
  • JATth@lemmy.world
    link
    fedilink
    arrow-up
    1
    ·
    edit-2
    13 days ago

    Python is just a pile of dicts/hashtables under the hood. Even the basic int type is actually a dict of method names:

    x = 1
    print(dir(x))
    ['__abs__', '__add__', '__and__', '__bool__', '__ceil__', '__class__', '__delattr__', '__dir__', ... ]
    

    PS: I will never get away from the fact that user-space memory addresses are also basically keys into the page table, so it is hashtables all the way down - you cannot escape them.

    • rain_worl@lemmy.world
      link
      fedilink
      arrow-up
      1
      ·
      edit-2
      13 days ago

      js is similar, though it does not include python’s precalculated numbers
      calculates integers from -5 to 256, see:

      > a = 100
      > b = 100
      > c = 1000
      > d = 1000
      > a is b
      True
      > c is d
      False
      
    • tiredofsametab@fedia.io
      link
      fedilink
      arrow-up
      2
      ·
      9 days ago

      I still sometimes bang out small perl scripts for things that are too annoying/complex for command prompt and shell scripts but not worth writing something in, say, Go. I never learned python which is probably why I never use that.

      • OpenStars@discuss.online
        link
        fedilink
        English
        arrow-up
        2
        ·
        9 days ago

        People keep saying Python, despite how it (1) sucks, and (2) is super annoying to keep up to date, with package management and the like, unlike Perl that is more stable. Though Python is also easy to use and powerful and extensible.

        But I think each language type is what it is and has its own set of tradeoffs and balances. Unix is hyper-stable and secure but limited, Perl is powerful but requires discipline to use to full effect, and these days most people don’t bother to learn it. Python is… “common”, is perhaps the best way to put it:-). C/C++ is even more powerful, the latter bloated, and blamed for most memory management issues (although really, how much of that is merely bad programming practice? Okay, so it allows such though).

        And now Rust is the new hot thing.:-)

        • tiredofsametab@fedia.io
          link
          fedilink
          arrow-up
          2
          ·
          9 days ago

          I enjoyed working with Rust once I got into its workflow. The borrow checker and lifetimes suck for people not used to the concepts. The funny thing about languages with lots of safety features is when people just unsafe things, an option in many languages to give oneself plenty of rope for a self-hanging (or, “footguns” is the hip new way of saying that).

          • OpenStars@discuss.online
            link
            fedilink
            English
            arrow-up
            2
            ·
            9 days ago

            I’m guessing it says “either I’m being forced to use this language or it’s the only related one I know how to use, but only halfway”:-)

  • gerryflap@feddit.nl
    link
    fedilink
    arrow-up
    0
    ·
    16 days ago

    Good meme. However I do think that most people starting out will not really have to deal with any of those issues in the first few years apart from maybe the pip/venv/poetry/etc choice. But whatever they’ll pick it’ll probably work well enough for whatever they’re doing. When I started out I didn’t use any external libraries apart from pygame (which probably came pre-installed). I programmed in the IDLE editor that came with Python. I have no idea how I functioned that way, but I learnt a lot and hat plenty of fun.

    • tiredofsametab@fedia.io
      link
      fedilink
      arrow-up
      1
      ·
      9 days ago

      I think experienced programmers may have a different route to a degree. A number of years in one language, for instance, including fairly complex production settings, etc. and having to transition to python for a new job or company or decision from someone higher up the food chain. I did it from a largely perl and PHP background for both Rust (a tiny bit of experience before, but not a super complex environment) and Go (zero to prod in a few months dropping in rewritten portions of the former PHP monolith). I can talk about memory usage, race conditions, etc. but would be completely screwed with anything internal to python or its quirks.