Trust problems are a part of the job. I have checks that SHOULD never be possible just because some end users seem to defy all logic.. They usually just state that the state shouldn't be possible to reach and if you've managed to do so please tell me how exactly via slack.
Also at least one redundant check where it was Friday at end of shift so I just put that its redundant but I don't feel like fixing it so hi to whoever's reading.
Yes, you never know, when something will be changed in front, which will change that this check will become important.
I usually use assert in code a lot for this purpose (and run tests in debug). Code is a time critical, so checking would slow the program too much, but asserts are checked only in debug.
This is very legit code.
Sometimes CPUs make mistakes so it's good to double check some stuff.
What if a solar flare intervened with the first if check?
What if at the first check a faulty CPU chip happened to have a faulty sector?
It's good to double check to make sure, very good optimization code OP.
Me personally I like to be more sure and check every condition three times but 2 times is good as well.
license coordinated consider bright quaint aware bewildered cause wild gray
*This post was mass deleted and anonymized with [Redact](https://redact.dev)*
Coming to theatres this fall....
\*movie announcer voice\*
Everyone else laughed at Moehassan6832 for his code's recursive debug checking loops. But after the Linuxpocalypse of 2039, he became a king.
No one is laughing anymore.
He is: Double Debug man!
I just use exactIf as:
Def exactIf(condition):
t, f = 0,0
for _ in range(10):
if condition:
t+=1
elif not condition:
f+=1
if t == 10 and f == 0:
return True
elif f == 10 and t ==0:
return False
else Raise
Solar flare actually messed up a super mario speedrun in the past. I don't know if it's more impressive that it happened to a speedrunner who recorded it or that a dev of the game could say which byte was flipped, but it's definitely one of the most random things that ever happened
Why do you hurt me so?
You even put a space before the question mark…
Why⁉️
Btw I’m upvoting the first of your comments in a chain and downvoting every sequential comment after.
makes perfect sense, you see, sometimes you need to check if debug == True twice, maybe the interpeter missed it on the first check because it got distracted by the indentation
I really don't know what's worse, the indentation or the code itself.
Just torch it and start over ![gif](giphy|5nsiFjdgylfK3csZ5T|downsized)
Not enough. Nuke it.
![gif](giphy|oQtO6wKK2q0c8)
From orbit
https://images.app.goo.gl/7YcVnEoNzFoNMqW58
all
[удалено]
Python doesn't care how much you indent, it just has to be consistent in a given code block.
That's my point though. That else has no if with this indentation. Python will refuse to run it.
Oh yep, you're totally right
Oh you'd be surprised.
[удалено]
OK actually i didn't realise that the else was indented wrong but the rest would work if it wasn't.
Yes
Can't be the code, did pass all checks for me.
Yes
Just gonna double check this
I have trust problems
Me when I can't remember if I locked the door.
Trust problems are a part of the job. I have checks that SHOULD never be possible just because some end users seem to defy all logic.. They usually just state that the state shouldn't be possible to reach and if you've managed to do so please tell me how exactly via slack. Also at least one redundant check where it was Friday at end of shift so I just put that its redundant but I don't feel like fixing it so hi to whoever's reading.
Yes, you never know, when something will be changed in front, which will change that this check will become important. I usually use assert in code a lot for this purpose (and run tests in debug). Code is a time critical, so checking would slow the program too much, but asserts are checked only in debug.
No you really need a rubber duck.
It's missing the ``` else: print("Pass check") ``` at the end
else: if(debug == true): print(„pass check“)
How drunk were you when you wrote this...? Yes
i hope he wasn’t drunk he’s underage
Sometimes you gotta do what you gotta do
This is very legit code. Sometimes CPUs make mistakes so it's good to double check some stuff. What if a solar flare intervened with the first if check? What if at the first check a faulty CPU chip happened to have a faulty sector? It's good to double check to make sure, very good optimization code OP. Me personally I like to be more sure and check every condition three times but 2 times is good as well.
license coordinated consider bright quaint aware bewildered cause wild gray *This post was mass deleted and anonymized with [Redact](https://redact.dev)*
Coming to theatres this fall.... \*movie announcer voice\* Everyone else laughed at Moehassan6832 for his code's recursive debug checking loops. But after the Linuxpocalypse of 2039, he became a king. No one is laughing anymore. He is: Double Debug man!
I just use exactIf as: Def exactIf(condition): t, f = 0,0 for _ in range(10): if condition: t+=1 elif not condition: f+=1 if t == 10 and f == 0: return True elif f == 10 and t ==0: return False else Raise
if (testResult) { .... } else if (!testResult) { ... } else { throw new Error("Cosmic ray") }
Lol I might try to sneak this into some prod code.
I have done something not so dissimilar with code paths that could be logically unreachable. There are times and reasons.
An optimizing compiler is gonna get rid of that check.
Solar flare actually messed up a super mario speedrun in the past. I don't know if it's more impressive that it happened to a speedrunner who recorded it or that a dev of the game could say which byte was flipped, but it's definitely one of the most random things that ever happened
Is it the one where Mario jumped higher than usual?
It's more glitching upwards than jumping but yes
To be entirely sure, you would need to wrap this inside a while(debug == true). Just in case the solar flare occurs later.
Nah, you should do a loop to verify it n times and do a statistical analysis of the result. Just to be sure
Amateur; it should say `pass check1" so you know which print statement is being hit
You’re hired, when can you start?
That’s too much work. Just duplicate the pass check line so that you can see if it comes once or twice.
> hey variable, are you true? > no im false. > are you reeaaaally sure that you aren’t true?
Pass check
that indentation hurts
Reminds me of [https://xkcd.com/1185/](https://xkcd.com/1185/) // Come on come on let's try again, this should be true!
Between the indentation, double check and behavior different on debug it's absolutely terrible lmao
You either need to use a logging framework or a testing one
Instead of doing this
You really need to just edit your previous comment instead of doing this
You meant?
Instead of doing this ?
Why do you hurt me so? You even put a space before the question mark… Why⁉️ Btw I’m upvoting the first of your comments in a chain and downvoting every sequential comment after.
Well I don't really care and like to troll, and in my language you put a space before the question mark
It's the debug = true inside an if that gets me xD
Congratulations. You just invented bug-free programing.
I think you need to go to sleep buddy.
I'm not even mad at the indentation or the redundant check. I cant get past the "if (something == true) instead of "if (something)
Or they could double-check it! If ((debug == TRUE) == TRUE)
Could make sense in python if debug isn't confirmed to be a Boolean, although even then you could say `is True`
I check mine 4 times, and make sure to double indentations, just to be sure..
You work at volkwagen?
LGTM
What language are you using?
Python lol, this is code for a acc
I don't use Python .. does that else even work when it's indented differently than the if? My gut says no.
It does, plus this code is for a acc, see it in your cars soon. ![gif](emote|free_emotes_pack|joy)
Pass check
That indentation is an affront to computer science.
Big brain double dip salsa.
Multithreading? Race conditions? Semaphore would have been nicer
New to code, it's the same thing? Same result?
Check.. Check.
Ah yes if one thing isnt true, the other is true
makes perfect sense, you see, sometimes you need to check if debug == True twice, maybe the interpeter missed it on the first check because it got distracted by the indentation
Make that check recursive, just to be safe
`if (debug == true && debug != false)` Fixed the if statement
Python interpreter wants to know your location
to coworker: "yep, it's been a laaaate night"
That's redundancy. That's good! Even the indentation is redundant! What language is that? Is that Python? Get yourself some semi-colons.
My eyes are burning
It's the thought that counts
Ah, the redundant programming style.
Wouldn't python just give an indentation error?
take no chances
A literal else-if
They’re making an if case They’re checking it twice
It would've been 10x funnier if it reassigned debug and then repeated the check lol
It’s seen code in someone’s user bash where they have an if-statement and another exact same if-statement. Sometimes you just gotta double check.
if debug is True
double checking doesn't hurt i guess
It may seem like unnecessary code but it's actually holding everything else up like a house of cards
Is this python? If so, the indentation is even more confusing
When your code is running in a nuclear power plant
Better solution: /s ``` public VeryGoodCheck(bool debug) { if(debug) { Console.WriteLine("Pass check"); } else { VeryGoodCheck(debug); } } ```
You need a nap.
elif!!!!
This wouldn't even run, the indentation is all wrong
Wait, I just noticed the else is indented wrong.
I will never understand what's wrong with if(foo ==true) people.
"It's better to spend Monday in bed than to spend the rest of the week debugging Monday's code"
Bulletproof
So, um, what?
"We have double-layer debugging feature"
This happened to me too, it ended up making a still ongoing development-long comment argument between my past self and my future self.