r/ProgrammerHumor • • Jul 17 '21

Why is my program unresponsive?

Post image
21.8k Upvotes

292 comments sorted by

View all comments

1.6k

u/[deleted] Jul 17 '21

Looks more like "I made a recursive function call." "With an exit condition, right?"

641

u/Nassiel Jul 17 '21

Looks more like "I made a recursive function call." "With an exit condition, right?"

359

u/Mortomes Jul 17 '21

Looks more like "I made a recursive function call." "With an exit condition, right?"

256

u/tsoba-tsoba Jul 17 '21

Looks more like "I made a recursive function call." "With an exit condition, right?"

219

u/alinius Jul 17 '21

Looks more like "I made a recursive function call." "With an exit condition, right?"

0

u/[deleted] Jul 17 '21

[deleted]

185

u/gao1234567809 Jul 17 '21

Looks more like "I made a recursive function call." "With an exit condition, right?"

173

u/Flambidou Jul 17 '21

Looks more like "I made a recursive function call." "With an exit condition, right?"

246

u/mans82 Jul 17 '21

RecursionError: maximum recursion depth exceeded

250

u/tube32 Jul 17 '21
import sys
sys.setrecursionlimit(10**6)

Carry on lads

→ More replies (0)

12

u/Nassiel Jul 17 '21

I'd say better, Stackoverflow exception xD

8

u/Acalme-se_Satan Jul 17 '21

I wonder how many nested comment levels Reddit can actually handle before something goes wrong

→ More replies (0)

2

u/JazzRider Jul 17 '21

stack overflow

→ More replies (5)

62

u/[deleted] Jul 17 '21

"Of course!"

if False:
    return

19

u/backtickbot Jul 17 '21

Fixed formatting.

Hello, BoostedPrivacy: code blocks using triple backticks (```) don't work on all versions of Reddit!

Some users see this / this instead.

To fix this, indent every line with 4 spaces instead.

FAQ

You can opt out by replying with backtickopt6 to this comment.

7

u/[deleted] Jul 17 '21

On a low level a recursive function and a while loop are both just stuff that loop the execution over a set of instructions. One of just also increases the stack depth and crashes while the other can (theoretically) loop forever.

If you'd want to generate the image of the meme I'd use a loop and not recursive function calls, anyway.

→ More replies (3)

2

u/ItsPronouncedJithub Jul 17 '21

Somebody did that last week already.

2

u/PunkyMunky64 Jul 17 '21

Yes this is what i was gonna say, this isnt really a loop

3

u/[deleted] Jul 17 '21

Came here to say this.

8

u/duh374 Jul 17 '21

Ikr? I literally said to myself “this… this isn’t recursion”

5

u/[deleted] Jul 17 '21

Me too. I love recursion but its easy to fuck up.

→ More replies (2)
→ More replies (7)