Guess Carefully User

2 years ago by other_cat to c/programmerhumor

semperverus 70 points 2 years ago

import os

Instant goblin behavior.

path: 0 15378233, hotness: undefined, score: 70, children: 0
brucethemoose 50 points 2 years 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.

path: 0 15378542, hotness: undefined, score: 50, children: 0
lugal 33 points 2 years ago

Is that the test driven programming everyone talks about?

path: 0 15378515, hotness: undefined, score: 33, children: 2
marcos 22 points 2 years ago

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

path: 0 15378515 15378925, hotness: undefined, score: 22, children: 0
heavydust 5 points 2 years 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.

path: 0 15378515 15379116, hotness: undefined, score: 5, children: 0
qjkxbmwvz 21 points 2 years ago

Code doesn't even pass the example test --- mind your case sensitivity!

path: 0 15380363, hotness: undefined, score: 21, children: 0
subignition 13 points 2 years ago

doomed by case sensitivity

path: 0 15378409, hotness: undefined, score: 13, children: 0
troyunrau 13 points 2 years ago

It's that hacker 4chan again

path: 0 15384130, hotness: undefined, score: 13, children: 0
daddy32 10 points 2 years 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!

path: 0 15394658, hotness: undefined, score: 10, children: 0
satans_methpipe 6 points 2 years ago

Localization dependent regex for this should be possible

path: 0 15386439, hotness: undefined, score: 6, children: 0
MeatPilot 5 points 2 years ago

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

path: 0 15380022, hotness: undefined, score: 5, children: 3
jbrains 9 points 2 years ago

*Bobby.

path: 0 15380022 15381250, hotness: undefined, score: 9, children: 2
MeatPilot 4 points 2 years ago

The boy ain't right.

path: 0 15380022 15381250 15381508, hotness: undefined, score: 4, children: 0
ByteJunk 1 point 2 years ago path: 0 15380022 15381250 15386053, hotness: undefined, score: 1, children: 0
iAvicenna 3 points 2 years ago

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

path: 0 15381120, hotness: undefined, score: 3, children: 0
programmerhumor
programmerhumor

@lemmy.world

login for more options
1896
74
825

go to feed...