Skip to content

Instantly share code, notes, and snippets.

@cocodrips
Last active August 29, 2015 14:01
Show Gist options
  • Select an option

  • Save cocodrips/f1fecdd7a579fca0293f to your computer and use it in GitHub Desktop.

Select an option

Save cocodrips/f1fecdd7a579fca0293f to your computer and use it in GitHub Desktop.
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