Created
September 4, 2016 00:02
-
-
Save jpthompson23/f8375169a07d8229ec4e34f053ff4993 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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