r/badcode • u/GeneticJulia • May 26 '20
python My coworker is learning Python... So he made himself a nest.
109
104
May 26 '20
For c in cnts... Nice
46
62
101
u/prettymuchamine May 26 '20
Image Transcription: Code
#code to delete bounding boxes from first frame.
if f=='0.png':
# yoo.append(cnts)
cnts=np.asarray([[[[0,0]]]])
if f=='1.png':
yoo.append(cnts)
if f=='2.png':
yoo.append(cnts)
if f=='3.png':
yoo.append(cnts)
if f=='4.png':
yoo.append(cnts)
if f=='5.png':
yoo.append(cnts)
if f=='6.png':
yoo.append(cnts)
if f=='7.png':
yoo.append(cnts)
if f=='8.png':
yoo.append(cnts)
if f=='9.png':
yoo.append(cnts)
if f=='10.png':
yoo.append(cnts)
if f=='11.png':
yoo.append(cnts)
if f=='12.png':
yoo.append(cnts)
if f=='13.png':
yoo.append(cnts)
if f=='14.png':
yoo.append(cnts)
if f=='15.png':
yoo.append(cnts)
else:
yoo=yoo
for c in cnts:
for g in c:
for x,y in g:
for q in yoo:
for t in q:
for w in t:
for m in w:
goo=(x,y)==(m[0],m[1])
if goo==True:
m=[0,0]
g=np.array([list(m)])
c=np.array(list(p))I'm a human volunteer content transcriber for Reddit and you could be too! If you'd like more information on what we do and why we do it, click here!
124
u/Gooftwit May 26 '20
I'm so sorry you had to type that out.
5
May 26 '20
They really need to train these people how to use OCR.
7
u/Teknikal_Domain May 27 '20
Disclaimer: not the transcriber, just another transcriber.
We have a bot to OCR text.
Trust me, it's not actually that competent most of the time... Can be used to help a little, but still needs a lot of editinf.
22
u/plg94 May 26 '20
Well he's pretty much a machine, I guess he's fine.
23
34
2
May 26 '20
Wow very commendable but surely this is exactly the kind of pita task that bots are made for.
3
u/polenannektator May 26 '20
Yea, except they arent. Bot are not yet able to recognize more complex stuff, like meme descriptions.
0
May 27 '20
why do people do this
1
u/prettymuchamine Aug 02 '20
To help people who use screen readers. Since they cannot detect text in images, we comment with what the images say and describe them.
92
36
u/random_cynic May 26 '20
I'm much more interested to know what is your coworker's background, who hired him and for what purpose. The particular language doesn't matter here, this violates every good programming principle out there. I've seen better Excel macros.
53
u/MarquisDan May 26 '20
What's the bigO on that?
50
65
May 26 '20
O(n7)
30
4
39
34
12
May 26 '20
I generally disagree with Linus Torvalds when he says 'Coding is not everyone' s cup of tea' but this subreddit continues to push me to the other side.
20
8
u/Monokuma_Follower May 26 '20
This code is like a motivational meme to show you that your code isn't that bad
5
15
7
6
10
5
u/swordsmanluke2 May 26 '20
All I can see is "yoo cnts" And that makes the code suddenly make sense. It's a giant FU to his co-workers
8
7
2
u/unhandledexceptionBB May 26 '20
Ive just really started learning code (I’ve worked with python but not in depth) but this just makes me die inside.
2
2
2
2
4
1
1
1
1
1
1
-23
u/samsop May 26 '20
I think being a newcomer (to a language or programming) automatically disqualifies your code from being posted here
37
23
u/AceOfBlack May 26 '20
So basically, 90% of bad code is disqualified from the subreddit about bad code? 🤔
24
u/samsop May 26 '20
Code written by a beginner is bad code by definition lol.
Obscure code that somehow finds its way to production is more like it. I don't get the shock value otherwise. You're surprised a newcomer isn't writing ninja code?
5
u/AceOfBlack May 26 '20
Totally! Maybe we should have some sort of qualification process (hackerrank can provide something) to make sure that people who write the programs on here have a minimum level of skill before we give ourselves permission to laugh at their poorly written code.
TLDR: Your comment is bad, and you should feel bad.
2
u/samsop May 26 '20
I'll perform seppuku later.
On an unrelated note, r/programminghorror somehow got the luck of the draw. That sub offers a more straightforward list of dos and don'ts with a good laugh here and there as well. Check it out if you wanna know what I mean!
2
u/sneakpeekbot May 26 '20
Here's a sneak peek of /r/programminghorror using the top posts of the year!
#1: Boeing. Making coding mistake since 1997. | 223 comments
#2: I'm also coming with you. | 124 comments
#3: I am scared to expand this switch statement.... | 109 commentsI'm a bot, beep boop | Downvote to remove | Contact ^^me | ^^Info | ^^Opt-out
7
u/meowrial May 26 '20 edited May 26 '20
I agree with and understand your sentiment.
But I still think it's fun to laugh at this and think about how we used to write stuff on this level when we starting out too.
3
270
u/luketheduke54 May 26 '20
It's all garbage and the for loops making me want to commit scooter ankle, but what could they possibly think this does?