Created
June 20, 2011 13:27
-
-
Save maxcountryman/1035597 to your computer and use it in GitHub Desktop.
Sleep sort in Python
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 thread | |
from time import sleep | |
items = [2, 4, 5, 2, 1, 7] | |
def sleep_sort(i): | |
sleep(i) | |
print i | |
[thread.start_new_thread(sleep_sort, (i,)) for i in items] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Thanks. This code (Python 2) has been updated to Python 3 in my fork.