r/programminghorror • u/Varzival • Nov 27 '25
Python if 'X' not in data
Emoji check used for constructing an email body. I'm getting a stroke.
825
Upvotes
r/programminghorror • u/Varzival • Nov 27 '25
Emoji check used for constructing an email body. I'm getting a stroke.
63
u/fakehalo Nov 27 '25
This is oddly beautiful if you ask me, elegant in a way.
131
u/freecodeio Nov 27 '25
If the emoji is well documented and common knowledge, I don't see why would this be wrong. I know I'm probably going to get downvoted but there's literally no downside. The catch is that this emoji should be treated like a piece of unicode gospel and not used under different scenarios.
337
u/dashhrafa1 Nov 27 '25
I agree! Hardcoded values should be avoided. It should be an environment variable.
63
u/Naynoona111 Nov 27 '25
A student once came seeking help their code cannot be run from a certain terminal while trying to measure the execution time via powershell.
The exception was from inside the print() function itself.
I spent some time tracing the code, apparently no errors are there! I began to question the OS itself and tried to run the code on another machine and still the same error.
After some precious minutes, I found this pesky line:
print("✔️[+] Encryption Successful✔️")I am disappointed in the new generation and disappointed in myself for taking time to solve this...
Yes, the student have copied the code from ChatGPT.
18
u/babalaban Nov 27 '25
People are noticing '❌' is bad, but none seemed to notice that both if-else brranches do the same thing with different variable, which could have been assigned based on these (atrocious) conditions.
6
u/centurijon Nov 27 '25
I’m guessing whatever upstream process populates
datawas created by AI? Mostly because the only time I’ve seen emojis in result messages it has been something built by AI5
u/GoddammitDontShootMe [ $[ $RANDOM % 6 ] == 0 ] && rm -rf / || echo "You live" Nov 27 '25
That's the best they could come up with for checking for failure? An emoji in the data?
2
u/aikii Nov 27 '25
That's probably one the sanest CI/CD-related snippet I've ever seen
2
u/mimminou Nov 29 '25
boolean flags used to be 1bit of size, 1 byte if not packed with other values. instead we now compare unicode emojis for error handling, how did we get here ?
1
u/TheAutisticSlavicBoy Nov 27 '25
Is that in the spec with MUST?
1
u/wobblyweasel Nov 27 '25
the good stroke or the bad stroke
1
u/Yannox_ Pronouns: He/Him Nov 30 '25
POV: You have to build a connector to a legacy system a guy 10 years ago coded without programming knowledge but the half of the company runs on it...
1
u/Key_Alfalfa261 Dec 03 '25
oh god