r/badcode • • Dec 03 '19

python So many things wrong...

Post image
707 Upvotes

106 comments sorted by

View all comments

Show parent comments

67

u/rickybflay Dec 03 '19

Came here to write that I feel like this does exactly what it's supposed to do.

47

u/archpawn Dec 03 '19

But they could have just used

while True:
    print('69')

33

u/kkjdroid Dec 04 '19

But this way, it eventually runs you out of RAM.

4

u/botle Dec 04 '19

Why would it run out of RAM? I'm not too familiar with Python, but in C it wouldn't happen.

8

u/hiimsoba Dec 04 '19

Simply put, x will get smaller and smaller, and it will take up more and more RAM to be represented in memory. Python has no limits for the number values, unlike C. Correct me if I'm wrong. :)

5

u/NathaanTFM Dec 04 '19

AFAIK Py2 has limits.

6

u/kkjdroid Dec 04 '19

When a number gets too big (or in this case, small) for its container to hold, Python just makes it a bigger container instead of wrapping around like C does.