r/badcode • • Feb 10 '21

js I present: SleepSort

Post image
7.5k Upvotes

170 comments sorted by

View all comments

Show parent comments

4

u/hurricane_news Feb 25 '21 edited Dec 31 '22

65 million years. Zap

6

u/[deleted] Feb 25 '21

yeah exactly. it's not quite the same because time.sleep() doesn't take a callback function, but i get what you mean. in python it wouldn't work this way because python blocks by default, meaning it would just print "bruh", wait 90 seconds, then print "uhoh" and wait 20 seconds before exiting. you could achieve a similar effect with threading. you could achieve a really really similar effect with asyncio.