r/badcode • • May 26 '20

python My coworker is learning Python... So he made himself a nest.

Post image
761 Upvotes

79 comments sorted by

270

u/luketheduke54 May 26 '20
yoo=yoo

It's all garbage and the for loops making me want to commit scooter ankle, but what could they possibly think this does?

34

u/CeeMX May 26 '20

yoo dawg, I heard yoo like yoo

14

u/Ochidi May 26 '20

Merely a statement of confirmation. A helpful reminder to others who will read the code.

3

u/ratmfreak Jun 24 '20

assertEquals(yoo, yoo)

If that ever fails, shit has gone cattywampus

4

u/Theyellowtoaster May 27 '20

A real answer, maybe they think they need to redeclare the variable inside the new scope or something? (Ignoring the fact that that’s not how scope works in python nor would redeclaring it make any sense)

But I may or may not have found something similar in my own code the other day...

1

u/Prom3th3an Jun 01 '20

Calls us "yoo cnts".

0

u/[deleted] May 26 '20

[deleted]

12

u/dstlny_97 May 26 '20

You missed the extra = after (x,y). It will work, since he's comparing equality of a tuple :)

22

u/jan04pl May 26 '20

21

u/UndeleteParent May 26 '20

UNDELETED comment:

Saying as this never runs:

goo=(x,y)=(m[0],m[1]) if goo==True: # ...

I would say it doesn't do anything.

please pm me if I mess up

0

u/[deleted] May 26 '20

[deleted]

10

u/dstlny_97 May 26 '20

Correct.

"goo" is being assigned to the result of (x,y) == (m[0], m[1]). Which is comparing if one tuple (x,y) is equal to == the other tuple (m[0], m[1])

7

u/[deleted] May 26 '20

9

u/UndeleteParent May 26 '20

UNDELETED comment:

That's a chained assignment, no comparison operator in sight there.

please pm me if I mess up

109

u/legoto May 26 '20

Wow every line is worse than the last...

104

u/[deleted] May 26 '20

For c in cnts... Nice

46

u/b1ack1323 May 26 '20
 for u in cnts

would have been funnier

7

u/[deleted] May 26 '20

This insult needs more traction.

62

u/[deleted] May 26 '20

Ya filthy cnt

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

u/[deleted] 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

u/reaper-is-happy May 26 '20

He's a real person tho :|

5

u/plg94 May 26 '20

I knew. But I misread his username as "prettymuchamachine".

34

u/blehmann1 depraved May 26 '20

good human

2

u/[deleted] 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

u/[deleted] 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

u/[deleted] May 26 '20

O(n7) Oh god Oh Fuck

64

u/TimGreller May 26 '20

O(fuck)

9

u/[deleted] May 26 '20

⭐🏅

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

u/lurebat May 26 '20

O(nope)

65

u/[deleted] May 26 '20

O(n7)

30

u/Aseriousness May 26 '20

Surprised that code doesn't use recursion to achieve O(7n!)

23

u/[deleted] May 26 '20

Memory : It's free real estate

4

u/xigoi May 26 '20

Can't determine without knowing what the variables are.

39

u/[deleted] May 26 '20

m = [0, 0]

list(m)

Always gotta double check!

34

u/telumv May 26 '20

Oh no, it built a nest. Kill it before it lays eggs!

12

u/[deleted] 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.

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

u/[deleted] May 26 '20

Was just thinking that. I feel so proud of my little garbage babies now.

3

u/axoncandy May 26 '20

Little garbage babies lol love it

15

u/more0001234 May 26 '20

There isn't even an elif there!

7

u/galiyaan May 26 '20

After reading this guido van rossum committed suicide

6

u/[deleted] May 26 '20

i just see “cunts” everywhere.

10

u/[deleted] May 26 '20

I can't even. No. Please, no more.

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

u/[deleted] May 26 '20

HE ALREADY BUILT A NEST! BURN IT SO THAT IT DOESN'T LAY EGGS

7

u/-Dueck- May 26 '20

If goo==True has to be the best if statement I have ever read

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

u/Yevgen4000 May 26 '20

Omg it's not even executing a different task what

2

u/jiniux May 26 '20

hope he's the cleaning guy

2

u/P-Pablo May 27 '20

Yandere Simulator flashbacks

4

u/offmycookies May 26 '20

My head hurts

1

u/zaz969 May 26 '20

O( n7 )

Why?

1

u/stevescola May 26 '20

Never have I ever seen such time complexity

1

u/[deleted] May 26 '20

This dude has a job?

1

u/[deleted] May 26 '20

So what would be a better way to implement this?

1

u/deelowe May 26 '20

god damn

1

u/[deleted] May 27 '20

What's the complexity on that? Also this makes me want to commit accidental stair fall

-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

u/[deleted] May 26 '20

This is pretty bad for beginner's standards..

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!

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

u/[deleted] May 26 '20

Newcomer detected.

-6

u/samsop May 26 '20

11

u/[deleted] May 26 '20

Gatekeeping gatekeeper detected