Last active
August 29, 2015 14:01
-
-
Save cocodrips/f1fecdd7a579fca0293f to your computer and use it in GitHub Desktop.
This file contains hidden or 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 threading | |
| import sys | |
| def sleepsort(array): | |
| for a in array: | |
| threading.Timer(a, echo, [a]).start() | |
| def echo(num): | |
| print num | |
| if __name__ == '__main__': | |
| argvs = sys.argv | |
| argc = len(argvs) | |
| if argc < 2: | |
| quit() | |
| array = map(int, argvs[1:]) | |
| sleepsort(array) | |
| # python sleep.py 5 3 2 1 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment