Skip to content

Instantly share code, notes, and snippets.

@jpthompson23
Created September 4, 2016 00:02
Show Gist options
  • Save jpthompson23/f8375169a07d8229ec4e34f053ff4993 to your computer and use it in GitHub Desktop.
Save jpthompson23/f8375169a07d8229ec4e34f053ff4993 to your computer and use it in GitHub Desktop.
import time
import threading
def sleep_print(n):
time.sleep(n)
print n
def thread_apply(func, item):
def run():
func(item)
threading.Thread(target=run).start()
def sleepsort(args):
for arg in args:
thread_apply(sleep_print, arg)
if __name__ == "__main__":
sleepsort([7,3,5,9,10,2,1,5])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment