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

Programmer Humor

1515 readers
10 users here now

founded 2 years ago
MODERATORS
 
top 15 comments
sorted by: hot top controversial new old
[–] [email protected] 9 points 1 day 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!

[–] [email protected] 68 points 2 days ago

import os

Instant goblin behavior.

[–] [email protected] 50 points 2 days 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.

[–] [email protected] 32 points 2 days ago (2 children)

Is that the test driven programming everyone talks about?

[–] [email protected] 21 points 2 days ago

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

[–] [email protected] 5 points 2 days 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.

[–] [email protected] 21 points 2 days ago

Code doesn't even pass the example test


mind your case sensitivity!

[–] troyunrau 12 points 2 days ago

It's that hacker 4chan again

[–] [email protected] 7 points 2 days ago

Localization dependent regex for this should be possible

[–] [email protected] 13 points 2 days ago

doomed by case sensitivity

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

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

[–] [email protected] 9 points 2 days ago (2 children)
[–] [email protected] 4 points 2 days ago

The boy ain't right.

[–] [email protected] 1 points 2 days ago

Oh yes. Little Bobby Tables we call him.

https://xkcd.com/327

[–] [email protected] 3 points 2 days ago

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