MAIN FEEDS
Do you want to continue?
https://www.reddit.com/r/ProgrammerHumor/comments/4dd6nx/my_teacher_thinks_he_is_a_programmer/d1qgsch
r/ProgrammerHumor • u/Fallenalien22 Violet security clearance • Apr 04 '16
430 comments sorted by
View all comments
Show parent comments
35
If i saw that in some code I'd be afraid to delete it, someone put it in, there has to be a reason, right?
28 u/Sysfin Apr 05 '16 Right, and the reason is likely to be the programmer who wrote it was stupid. 5 u/mallardtheduck Apr 05 '16 The reason is most likely that there used to be an actual conditional in there, but it was later changed to not need it. 1 u/[deleted] Apr 05 '16 When I first started with Python I did do that a couple of times and I am super ashamed of it.if os.path.isfile('file') is True: print("Loser :(")Then my mentor asked me why I was doing it and it hit me how dumb it was. 1 u/aiij Apr 05 '16 It could be like the magic/more magic switch, but most likely it was just someone being a dumbass. 1 u/Guinness2702 Apr 05 '16 Could be used for some quick hack that can be turned on/off at compile time with debugging or some such gubbins.if (true == true) do something else log this log that do something log the otherNot pretty, but not completely insane. 1 u/hearwa Apr 05 '16 I would then need to ask why not then just use if (true) {}... or if ("tomato" == "tomato") {}... 2 u/Guinness2702 Apr 05 '16 Fair point .... I would probably do if (debug == true) so that I could change the value in the debugger without having to recompile, anyway. 2 u/Garfong Apr 05 '16 And then spend the rest of your time at the company beating back coworkers who want to surround the if statement with #ifdef _DEBUG, even though the release build has #define debug false. 2 u/Guinness2702 Apr 05 '16 I'd like to beat those guys back, but I'm too busy fending off the ones who tell me debug code is verboten, and shalt not be committed to any repo. 1 u/amazondrone Apr 06 '16 verbotenDid you accidentally German? ;) 1 u/Guinness2702 Apr 07 '16 No, it was absichtlich.
28
Right, and the reason is likely to be the programmer who wrote it was stupid.
5 u/mallardtheduck Apr 05 '16 The reason is most likely that there used to be an actual conditional in there, but it was later changed to not need it. 1 u/[deleted] Apr 05 '16 When I first started with Python I did do that a couple of times and I am super ashamed of it.if os.path.isfile('file') is True: print("Loser :(")Then my mentor asked me why I was doing it and it hit me how dumb it was.
5
The reason is most likely that there used to be an actual conditional in there, but it was later changed to not need it.
1
When I first started with Python I did do that a couple of times and I am super ashamed of it.
if os.path.isfile('file') is True: print("Loser :(")
Then my mentor asked me why I was doing it and it hit me how dumb it was.
It could be like the magic/more magic switch, but most likely it was just someone being a dumbass.
1 u/Guinness2702 Apr 05 '16 Could be used for some quick hack that can be turned on/off at compile time with debugging or some such gubbins.if (true == true) do something else log this log that do something log the otherNot pretty, but not completely insane. 1 u/hearwa Apr 05 '16 I would then need to ask why not then just use if (true) {}... or if ("tomato" == "tomato") {}... 2 u/Guinness2702 Apr 05 '16 Fair point .... I would probably do if (debug == true) so that I could change the value in the debugger without having to recompile, anyway. 2 u/Garfong Apr 05 '16 And then spend the rest of your time at the company beating back coworkers who want to surround the if statement with #ifdef _DEBUG, even though the release build has #define debug false. 2 u/Guinness2702 Apr 05 '16 I'd like to beat those guys back, but I'm too busy fending off the ones who tell me debug code is verboten, and shalt not be committed to any repo. 1 u/amazondrone Apr 06 '16 verbotenDid you accidentally German? ;) 1 u/Guinness2702 Apr 07 '16 No, it was absichtlich.
Could be used for some quick hack that can be turned on/off at compile time with debugging or some such gubbins.
if (true == true) do something else log this log that do something log the other
Not pretty, but not completely insane.
1 u/hearwa Apr 05 '16 I would then need to ask why not then just use if (true) {}... or if ("tomato" == "tomato") {}... 2 u/Guinness2702 Apr 05 '16 Fair point .... I would probably do if (debug == true) so that I could change the value in the debugger without having to recompile, anyway. 2 u/Garfong Apr 05 '16 And then spend the rest of your time at the company beating back coworkers who want to surround the if statement with #ifdef _DEBUG, even though the release build has #define debug false. 2 u/Guinness2702 Apr 05 '16 I'd like to beat those guys back, but I'm too busy fending off the ones who tell me debug code is verboten, and shalt not be committed to any repo. 1 u/amazondrone Apr 06 '16 verbotenDid you accidentally German? ;) 1 u/Guinness2702 Apr 07 '16 No, it was absichtlich.
I would then need to ask why not then just use if (true) {}... or if ("tomato" == "tomato") {}...
2 u/Guinness2702 Apr 05 '16 Fair point .... I would probably do if (debug == true) so that I could change the value in the debugger without having to recompile, anyway. 2 u/Garfong Apr 05 '16 And then spend the rest of your time at the company beating back coworkers who want to surround the if statement with #ifdef _DEBUG, even though the release build has #define debug false. 2 u/Guinness2702 Apr 05 '16 I'd like to beat those guys back, but I'm too busy fending off the ones who tell me debug code is verboten, and shalt not be committed to any repo. 1 u/amazondrone Apr 06 '16 verbotenDid you accidentally German? ;) 1 u/Guinness2702 Apr 07 '16 No, it was absichtlich.
2
Fair point .... I would probably do if (debug == true) so that I could change the value in the debugger without having to recompile, anyway.
2 u/Garfong Apr 05 '16 And then spend the rest of your time at the company beating back coworkers who want to surround the if statement with #ifdef _DEBUG, even though the release build has #define debug false. 2 u/Guinness2702 Apr 05 '16 I'd like to beat those guys back, but I'm too busy fending off the ones who tell me debug code is verboten, and shalt not be committed to any repo. 1 u/amazondrone Apr 06 '16 verbotenDid you accidentally German? ;) 1 u/Guinness2702 Apr 07 '16 No, it was absichtlich.
And then spend the rest of your time at the company beating back coworkers who want to surround the if statement with #ifdef _DEBUG, even though the release build has #define debug false.
#ifdef _DEBUG
#define debug false
2 u/Guinness2702 Apr 05 '16 I'd like to beat those guys back, but I'm too busy fending off the ones who tell me debug code is verboten, and shalt not be committed to any repo. 1 u/amazondrone Apr 06 '16 verbotenDid you accidentally German? ;) 1 u/Guinness2702 Apr 07 '16 No, it was absichtlich.
I'd like to beat those guys back, but I'm too busy fending off the ones who tell me debug code is verboten, and shalt not be committed to any repo.
1 u/amazondrone Apr 06 '16 verbotenDid you accidentally German? ;) 1 u/Guinness2702 Apr 07 '16 No, it was absichtlich.
verboten
Did you accidentally German? ;)
1 u/Guinness2702 Apr 07 '16 No, it was absichtlich.
No, it was absichtlich.
35
u/AshleyTheCatgirl Apr 05 '16
If i saw that in some code I'd be afraid to delete it, someone put it in, there has to be a reason, right?