r/badcode • u/Old-Yogurtcloset-629 • Oct 08 '22
python found this on my pc from the person using it around a year ago (definitly not me), what do you think?
770
Upvotes
r/badcode • u/Old-Yogurtcloset-629 • Oct 08 '22
264
u/gabrielesilinic Oct 08 '22
Yandere simulator has higher quality code than this
61
u/[deleted] Oct 08 '22
I know stupid question, but do non-English speaking countries code in weird hybrid language?
204
u/czerilla Oct 08 '22
The moment during writing your code when you begin to think "should I maybe automate writing the remaining code blocks?" is the point where you should catch yourself and reassess what may have gone wrong. 😉
181
u/Es452002 Oct 08 '22 edited Oct 08 '22
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!
54
u/No-Witness2349 Oct 08 '22
Doesn’t look like we have the whole script for context, but based off of what’s here and the comment by OP saying it’s standard to code in English, this is what I came out with:
91
u/MegaBatchGames Oct 08 '22
fileLenght
12
u/Neuro_Skeptic Oct 08 '22
Plot twist: the person using it a year ago was OP.
8
u/FOSSandCakes Oct 08 '22
Cyclomatic complexity :'(
6
u/AwkwardTask Oct 08 '22
Hallo.
6
u/Jagerjj Oct 08 '22
The fact that you mentioned it's definitely not you makes me almost certain it is you
5
u/Gwompsh Oct 08 '22
This should be 3 lines of code lol.
4
u/ShadowLp174 Oct 08 '22
Ohh god wenn you can't entscheiden wether to write in english oder deutsch
It hurts so much to see umlauts in code
4
u/Salt-Significance702 Oct 08 '22
Signs of a psychopath: Volume 1
3
u/[deleted] Oct 08 '22
Comment out all the prints, no output, no errors, it…just…works.
3
u/bazeloth Oct 08 '22
This is why you reinstall a pc when someone leaves the office.
3
u/MRaximillian Oct 08 '22
German coding. Die beste . . . . . . . . . . NEIN
3
u/Who_ate_my_profile Oct 09 '22
Im dumb what does it do?
6
u/[deleted] Oct 08 '22
They left out currentSign = Vunderbar
2
u/Vitringar Oct 08 '22
Wouldn't a python list make some sense in this context?
2
u/paulohbear Oct 09 '22
I was just thinking that one could really obfuscate things by naming variables in Navaho.
2
u/mojo2600 Oct 09 '22
German engineering at its best!
2
u/yturijea Oct 09 '22
Someone hadn't learned about maps/dictionaries for sure
2
u/[deleted] Oct 09 '22
Looks like CVS receipt.
Idk why I’m talking shit I write bad code too
2
u/Farpafraf Oct 10 '22
...why not a map?
1
u/johnathanesanders Oct 08 '22
Thank goodness, you found my computer!
1
u/Necessary-Estimate53 Oct 08 '22
add at least SWITCH statement to make it c compat. god knows this switch needs a switch. its most probably bad hardware, not bad coder intentions
1
u/[deleted] Oct 08 '22
Vfalse and { both have buggy code and it irks me so much.
1
u/yuki_n_ Oct 08 '22
Top left of https://twitter.com/richcampbell/status/1573326369710374912/photo/1
1
u/dDollardt Oct 08 '22
It wasn't you, it was you a year ago
1
u/schoonit Oct 08 '22
Coder was high AF
1
u/[deleted] Oct 09 '22
DRY Do not repeat yourself
This is why this principle exists lol 😂 I love coding I’m sure this code works too which makes me laugh even more.
1
u/Hitman_0_0_7 Oct 09 '22
All good..... The only thing is it has incorrect spells for Length
1
u/Glorious_Purpose_777 Oct 09 '22
I, I don’t like that.
1
u/Magicrafter13 Oct 10 '22
The fact that you put each if farther to the right is what really bothers me.
Edit: just realized this is Python. Now I'm just sad
elifisn't a thing.1
u/CozyPoo Oct 12 '22 edited Oct 12 '22
I'm honestly more bothered by the excessive tabs than the large amount of nested ifelse statements. It's leaning more than the Tower of Pisa lol
(and yes, indentation is important, but two white spaces would've sufficed and this is my OCD at play)
1
u/lmux Oct 14 '22
The python version of pyramid of doom. Lol.
1
u/nakuracten8 Oct 14 '22
That looks like my regular proframming class code, except it's in C. What's so bad about this?
1
u/alexander_the_crepe Oct 21 '22
+1 for logical legibility
1
u/HolyMackerelIsOP Nov 02 '22
how????
1
u/spaceballinthesauce Nov 02 '22
is that supposed to be a tokenizer?
1
u/bravopapa99 Nov 03 '22
I can hear Led Zepp, stairway to heaven, except it's going the wrong way
1
u/serendipitybot Nov 06 '22
This submission has been randomly featured in /r/serendipity, a bot-driven subreddit discovery engine. More here: /r/Serendipity/comments/ynq31s/found_this_on_my_pc_from_the_person_using_it/
1
u/ViviansUsername Nov 06 '22
Ik dictionaries are a valid solution, but it's been a while since I've touched python, would a switch case not also be better?
I would probably go with the dictionary option, but my knee jerk reaction was a switch case, which might still be repetitive, but a lot less.. nested.
Still O(n) checks instead of O(1), but.. a bit cleaner, at least.
1
u/Rogoreg Nov 11 '22
It isn't horrible, but it is bad. I don't think you need that. Wouldn't a switch statement be cleaner? Or at least by using Elif instead of putting another if inside the else part.
1
u/AshFace15 Nov 12 '22
I…hate it…🫠
1
u/dfdfdfdfdasdafd Nov 16 '22
this pattern of code is the staircase pattern
1
u/PelOdEKaVRa535000 Dec 22 '22
Try running it, probably works
1
u/[deleted] Oct 08 '22
I have seen such problems in videos there are 2 solutions
Either get a != condition and return an exception so the remaining code after it does not run
OR
Make the conditions a dictionary keys and values as function values
1
u/No-Witness2349 Oct 08 '22
There are even typos in the names like “currenSign = Vtrue” and “currentSign == Vfalse”, which means that this was hand-typed, not copy pasted
0
u/[deleted] Oct 08 '22
oh gott, was für ein albtraum
-20
u/Ebilkill Oct 08 '22
This is amazing code quality for python!
I don't like python so I don't see a better way to do this than nested if (/elif) so someone might want to enlighten me lmao
Aside from that, why is there German mixed in with the code? I don't like inconsistency, not even all their own code is written in German with only English for library calls...
0
u/[deleted] Oct 08 '22
[deleted] — view deleted comment