When you transliterate to python a code that uses double-checked locking pattern, but decided that you don't need asyncio.Lock and don't reread your code again.
Short explanation: store your array of elements in a region in memory that is exposed to cosmic rays and wait until these flip the bits just right to sort your elements.
def check_times(cond, times = 2):
return cond() and check_times(cond, times - 1) if times > 0 else True
# ...
if check_times(lambda: region):
await ctx.followup.send(REGION_REQUIRED)
return
179
u/Not_Arkangel May 21 '23
//WARNING: CHANGING THIS BREAKS EVERYTHING
136
u/thepurpleproject May 21 '23
you have race condition without telling me you have a race condition
103
u/anth096 May 21 '23
Just make it one line:
52
u/TheBrainStone May 21 '23 edited May 21 '23
I mean you could have a set of cosmic rays hit the computer and flip some bits. Can never know!
I've seen my fair share of cosmic ray detectors (read stupidly redundant checks) in my time. This is pretty tame.
27
u/realGharren May 21 '23
Protects against cosmic rays flipping a bit in the wrong moment.
25
u/mikkolukas May 21 '23
♫♪♫♪♫♪♫♪♫♪♫♪
♫♪♫♪♫♪♫♪♫♪♫♪
I could't get the melody out of my head when reading the code 😂
10
u/MurdoMaclachlan public boolean isInt(int i) { return true; } May 21 '23
Image Transcription: Code
I'm a human volunteer content transcriber and you could be too! If you'd like more information on what we do and why we do it, click here!
14
u/czerilla May 21 '23
🎶 Santa Claus is validating inputs tonight.. 🎶
6
u/Fuelanemo149 May 21 '23
5
u/delarcoz May 21 '23
Could use a loop to check it how many times you want
5
u/PositiveUse May 21 '23
Better safe than sorry
4
u/Objective_Initial480 May 21 '23
How can i trust a line
When all the love letters of my ex turned out to be lies.
1
u/jaysuchak33 ifelseifelseifelseifelseifelseifelseifelseifelseifelseifelse May 22 '23
theme and extensions 🥺🥺
3
u/pau1rw May 21 '23
It's possibly just a merge conflict that was resolved without reading it properly.
1
u/R3GENERATion_NATion May 21 '23
It would help if you actually called “break” in the first of nesting then put the second outside 😀
1
u/bottleofyourneck May 21 '23
Is it possible actually to overwrite
isoperator to change the value ofregion?1
u/RPG_Hacker May 22 '23
Pictured: Writing multi-threaded code before learning about mutexes and atomics.
1
u/MkemCZ May 23 '23
Let me help!
1
u/Aperture_Executive2 Jun 04 '23
# double checking to make sure a cosmic ray didn’t flip a bit in between if statements