this post was submitted on 07 Aug 2025
628 points (98.3% liked)

Programmer Humor

37637 readers
790 users here now

Post funny things about programming here! (Or just rant about your favourite programming language.)

Rules:

founded 6 years ago
MODERATORS
top 50 comments
sorted by: hot top controversial new old
[–] Cevilia@lemmy.blahaj.zone 8 points 5 hours ago (3 children)

Ah, Python. It might not be fast, but it gets it right in the end. :)

[–] MashedTech@lemmy.world 1 points 2 hours ago (1 children)

Just wait till they get rid of GIL!

[–] Valmond@lemmy.world 1 points 1 hour ago

And get a whole bunch of multi threading horrors...

[–] barubary@infosec.exchange 2 points 5 hours ago (1 children)
$ python3 -c 'f = (lambda x: x + 0.5 - 0.5); print(f(2**52))'  4503599627370495.5

#python

[–] Cevilia@lemmy.blahaj.zone 4 points 3 hours ago

Ahh, contrived examples of floating point errors. I haven't seen those since I asked Javascript to add 0.1 and 0.2 :)

[–] HeyThisIsntTheYMCA@lemmy.world -4 points 3 hours ago (1 children)

my dudes i had the idea for the stupidest little app that i could charge 50 cents for that maybe a million people would download because like 50 cents but i have no idea how to code beyond "hello world" and I AM NOT VIBE CODING AAAA

it's a map you put pins with notes in it. you will get nothing more than that out of me because it's very cute and then you will make it

[–] tfm@europe.pub 4 points 1 hour ago (1 children)
[–] wheezy@lemmy.ml 86 points 18 hours ago* (last edited 18 hours ago) (6 children)

I know people joke around about this a lot. But I was blown away by a recent switch to I did from using cv2 with python to using cv2 with C++.

I had literally hundreds of thousands of images to analyze for a dataset. My python script would have taken 12 hours.

I ported it to C++ and it literally destroyed it in 20 minutes.

I'm sure I was doing something that really wasn't optimized well for python. I know somewhere in the backend it probably was using a completely different library with multi thread optimization. Or maybe turbojpg is just garbage in python. I'm still not even sure what the bottleneck was. I don't know enough to really explain why.

But holy shit. I never had that much of a performance difference in such a simple task.

Was very impressed.

[–] HiddenLayer555@lemmy.ml 1 points 2 hours ago

Might be latency? Python is probably slower to respond to things like when one job is done and the next job can start, since it needs time to interpret the code and call the relevant C libraries.

I ran into a similar situation many years ago, when I was trying to write a software synthesizer using Visual Basic (version 4 at the time). The big problem is that if you're doing sample-by-sample processing of audio data in a loop (like doing pixel-by-pixel processing of images) and your chosen language's compiler can't compile to a native EXE or inline calls, then you end up suffering the performance hit of function calls that have to be made for each sample (or pixel). In many applications you're not making a lot of function calls and the overall performance hit is negligible, but when you're doing something where you're making hundreds of thousands or even millions of calls per second, you're screwed by the overhead of the function calls themselves - without there being any other sort of inefficiency going on.

In my case, I eventually offloaded the heavy sample processing to a compiled DLL I wrote in C, and I was able to keep using Visual Basic for what it did really well, which was quickly building a reliable Windows GUI.

[–] barubary@infosec.exchange 55 points 16 hours ago (1 children)

If you had let me write the C++ code, I could have literally destroyed your dataset in a couple of seconds.

[–] ThunderComplex 24 points 14 hours ago

I don’t even need C++ for this just give me a rm with a side dish of -rf

[–] jsomae@lemmy.ml 30 points 17 hours ago

Exactly what this comic is saying. C++ can handle in 20 minutes what takes python 12 hours, but something gets destroyed.

[–] bitwolf@sh.itjust.works 11 points 14 hours ago (1 children)

I had a similar experience processing PDFs of building plans. 4-8k PDFs, took 5-10minutes in Python.

I ended up switching to node.js and it processed the same PDFs in 120 seconds.

Over the years I only really find Python useful for interviewing and occasionally in ci pipelines.

[–] wheezy@lemmy.ml 8 points 12 hours ago

It's a great tinkering language. Which is a lot of what I do for personal projects no one else will ever see. I find it's biggest strength is also it's biggest weakness. It's really easy to write that you assume you don't have to care about under the hood stuff.

But something as simple as using a list instead of a set can turn a 2 minute script into a 2 hour script pretty quickly.

I remember when I first started using it I was working with building a list and then comparing elements of another list to see if it was contained.

My list was static in the comparison so I just did a "x in Y".

Y was massive though.

If I was using any other language I would have thought about the data type more and obviously use a set/hash for O(1) lookup. But since I was new to python I didn't even think about it because it didn't seem to give a fuck about data types.

A simple set_a = set(list_a) was all I needed. I think python is so easy to pick up that no one even bothers to optimize what they are writing. So you get even worse performance than it should have.

[–] sugarfoot00@lemmy.ca 21 points 17 hours ago (1 children)

But make sure to bill for the full 12 hours.

[–] wheezy@lemmy.ml 14 points 16 hours ago* (last edited 16 hours ago)

Was a personal project. But absolutely. Half my job is trying to explain why something is taking so long when in reality I actually it's already done I just don't want to do nothing for the next few days.

Managers never really know. And other engineers don't care. It's all about balancing expectations.

[–] jacecomix@sh.itjust.works 29 points 18 hours ago (1 children)

These comics are always fun to read because as an R user, I only ever hear about how fast python is.

[–] bobbyfiend@lemmy.ml 6 points 18 hours ago

Not having true vectorization and having to regularly code that into Python helps even the odds.

[–] bobbyfiend@lemmy.ml 24 points 18 hours ago (1 children)

This has got to be the best, most legitimately funny programmer/computer joke I've seen in years.

[–] tfm@europe.pub 5 points 16 hours ago

I thought that too! :D

[–] lime@feddit.nu 86 points 23 hours ago* (last edited 23 hours ago) (2 children)

alternative joke

C++: "Hey, what's your name?"
Python: *grabs C++* "what is my name?"

[–] TheGuyTM3@lemmy.ml 2 points 3 hours ago

It's now cannon in my head that Python talks like Parappa the rapper

[–] Hadriscus@jlai.lu 26 points 18 hours ago (2 children)

please explain I want to laugh

[–] lime@feddit.nu 14 points 14 hours ago (1 children)

one of python's strong suits is it's foreign function interface. it's very easy to call code in other languages from python, which can speed execution up significantly

[–] Hadriscus@jlai.lu 2 points 8 hours ago

oh alright. Cheers, heheh. I laughed

[–] anomnom@sh.itjust.works 25 points 18 hours ago (3 children)

Pythons weak typing means it never knows what is what. It’s up to the programmer to not screw it up.

[–] Splendid4117@piefed.social 26 points 17 hours ago (1 children)

I think it's more that a ton of popular python libraries (things like pandas, tensor, etc) are actually built in C, so python is just C wearing a mask

[–] lone_faerie@lemmy.blahaj.zone 15 points 17 hours ago

Not just libraries, the entire language itself is actually C under the hood

[–] theherk@lemmy.world 7 points 16 hours ago

Python is strongly typed. I get your point since it is dynamically typed, but still strongly.

[–] lime@feddit.nu 3 points 14 hours ago

not really what i was going for

[–] HiddenLayer555@lemmy.ml 22 points 20 hours ago (5 children)

Python's core implementation is in C though. It's just a fancy way to call C libraries.

[–] MoonMelon@lemmy.ml 2 points 2 hours ago

Python is actually pretty baller with string operations too since so much of the C has been heavily optimized.

[–] ddplf@szmer.info 11 points 15 hours ago (2 children)

I code in JS, so I'm something of a C dev myself!

[–] noddy@beehaw.org 3 points 7 hours ago

Aschhually the most used JS engine is made in C++ (v8)

[–] Natanox@discuss.tchncs.de 7 points 11 hours ago

Beginning your sentence with "I code in JS" really makes any follow-up statement sound sane in comparison.

[–] whimsy@lemmy.zip 30 points 20 hours ago (1 children)

You could say this about a lot of things...

[–] RvTV95XBeo@sh.itjust.works 1 points 1 hour ago

Pizza's core implementation is in C though. It's just a fancy way to call C libraries.

Today I learned pepperoni is a C library.

load more comments (2 replies)
[–] Jumuta@sh.itjust.works 27 points 22 hours ago* (last edited 22 hours ago) (1 children)
[–] HiddenLayer555@lemmy.ml 11 points 20 hours ago* (last edited 20 hours ago)
[–] qjkxbmwvz@startrek.website 17 points 20 hours ago (1 children)

It's interesting that, with Python, the reference implementation is the implementation


yeah there's Jython but really, Python means both the language and a particular interpreter.

Many compiled languages aren't this way at all


C compilers come from Intel, Microsoft, GNU, LLVM, among others. And even some scripting languages have this diversity


there are multiple JavaScript implementations, for example, and JS is...weird, yes, but afaik can be faster than Python in many cases.

I don't know what my point is exactly, but Python a) is sloooow, and b) doesn't really have competition of interpreters. Which is interesting, at least, to me.

[–] flubba86@lemmy.world 10 points 17 hours ago

Pypy is often considered the "best" alternative Python implementation. In some cases it can be much faster. But it's often one or two versions behind, and not 100% compatible, and of course it doesn't work with native Cpython extensions.

[–] officialdakari@sopuli.xyz 24 points 1 day ago (2 children)
[–] brokenlcd@feddit.it 41 points 23 hours ago* (last edited 23 hours ago) (2 children)

Javascript's still arriving to the meeting

[–] badcommandorfilename@lemmy.world 57 points 23 hours ago (1 children)

It had to download 300 of it's buddies first

[–] protogen420@lemmy.blahaj.zone 14 points 21 hours ago (1 children)
load more comments (1 replies)
[–] Sonotsugipaa@lemmy.dbzer0.com 18 points 21 hours ago

Javascript took the wrong turn and ended up in [object Object]

load more comments (1 replies)
load more comments
view more: next ›