this post was submitted on 28 Feb 2025
428 points (98.2% liked)

Programmer Humor

1832 readers
5 users here now

founded 2 years ago
MODERATORS
 
top 15 comments
sorted by: hot top controversial new old
[–] semperverus@lemmy.world 70 points 1 year ago

import os

Instant goblin behavior.

[–] brucethemoose@lemmy.world 50 points 1 year ago

Terrible code.

os.remove does not remove folders, for that you want shutil.rmtree().

Best to just do the user data folder since that’s where you have permission anyway.

[–] lugal@lemmy.dbzer0.com 33 points 1 year ago (2 children)

Is that the test driven programming everyone talks about?

[–] marcos@lemmy.world 22 points 1 year ago

Exactly. You write the tests first so you know exactly when not to remove Windows.

[–] heavydust@sh.itjust.works 5 points 1 year ago

That would be true if there were tests. If you work in banking or any other field with very specific specs and regulations, the program is almost perfect and answers the demands of the client.

The undefined behavior is too much though, he should throw an exception instead.

[–] qjkxbmwvz@startrek.website 21 points 1 year ago

Code doesn't even pass the example test


mind your case sensitivity!

[–] subignition@fedia.io 13 points 1 year ago

doomed by case sensitivity

[–] troyunrau@lemmy.ca 13 points 1 year ago

It's that hacker 4chan again

[–] daddy32@lemmy.world 9 points 1 year ago

I got once disqualified from a programming competition for including cases like that - and I was even nice enough to not include the os.remove thing!

[–] satans_methpipe@lemmy.world 6 points 1 year ago

Localization dependent regex for this should be possible

[–] MeatPilot@lemmy.world 5 points 1 year ago (1 children)

Little Johnny "DROP TABLE ?" up to it again I see.

[–] jbrains@sh.itjust.works 9 points 1 year ago (2 children)
[–] MeatPilot@lemmy.world 4 points 1 year ago

The boy ain't right.

[–] ByteJunk@lemmy.world 1 points 1 year ago

Oh yes. Little Bobby Tables we call him.

https://xkcd.com/327

[–] iAvicenna@lemmy.world 3 points 1 year ago

all he wanted was to get his cs101 hw done. all he got was computer reckt