this post was submitted on 16 Sep 2024
449 points (97.7% liked)

Programmer Humor

19511 readers
515 users here now

Welcome to Programmer Humor!

This is a place where you can post jokes, memes, humor, etc. related to programming!

For sharing awful code theres also Programming Horror.

Rules

founded 1 year ago
MODERATORS
 
top 50 comments
sorted by: hot top controversial new old
[–] [email protected] 4 points 1 month ago

Python 3.13 is adding support for removing GIL, via PEP 703

[–] [email protected] 14 points 1 month ago (3 children)

Reject modernity

Return to C

[–] [email protected] 6 points 1 month ago (2 children)

Reject tradition

Embrace scratch

[–] [email protected] 0 points 1 month ago
[–] [email protected] 3 points 1 month ago (1 children)

You're the "chaotic evil" guy aren't you

[–] [email protected] 1 points 1 month ago

When everything's a dictionary, nothing will be

[–] [email protected] 4 points 1 month ago

Reject modernity

Return to z80 Assembly

[–] [email protected] 1 points 1 month ago
[–] [email protected] 14 points 1 month ago* (last edited 1 month ago) (2 children)

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.

[–] [email protected] 3 points 1 month ago* (last edited 1 month 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
[–] [email protected] 5 points 1 month ago

audible C++ programmer disgust

[–] [email protected] 17 points 1 month ago (1 children)

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
      '';
    };
  });
}

[–] [email protected] 2 points 1 month ago (1 children)

I've been intrigued by Nix for quite a while. I will learn it as well.

[–] [email protected] 12 points 1 month ago

It feels like magic. I think of it as the glue that makes almost all of my software work together seamlessly. I can’t wait to use it for one-click deployments of my software on a server or high-availability cluster.

[–] [email protected] 8 points 1 month ago

Man, the variable scoping thing is insidious. It will never not be weird to me that ifs and loops don't actually create a new scope.

And then you try to do a closure and it tells you you didn't import anything yet.

[–] [email protected] 14 points 1 month ago (2 children)

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.

[–] [email protected] 1 points 1 month 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.

[–] [email protected] 10 points 1 month ago (1 children)

What about the issue where people try to install new version of python sometimes try to uninstall the "old" pre-installed version on a linux system and thus borking the whole s

Definitely not me, anymore

[–] [email protected] 7 points 1 month ago

I may or may not have done this haha. I'm a threat to any working piece of software, just enough knowledge to be able to break shit and too little knowledge to avoid breaking shit. I think after all these years I've mostly learnt my lesson though. The package manager is the boss, and if I don't like it I have to work around it without upsetting the package manager

[–] [email protected] 21 points 1 month ago

This a much better done meme

The other one before makes zero sense

[–] [email protected] 14 points 1 month ago (2 children)

I find Python easy to just code a prototype with. But I find Rust easier to get right.

[–] [email protected] 5 points 1 month ago

This is basically what I’ve been telling people for years. Prototype in Python to get the concepts down, then when you’re serious about the project, write it in a serious language.

load more comments
view more: next ›