Help us understand the problem. What is going on with this article?

手習いsleepsort

More than 5 years have passed since last update.
sleep_sort.py
import threading
import time

sort_list = [1, 3, 6, 8, 10, 33, 44, 23]

def sort(lis):
    answer_list = []
    for num in lis:
        thread = threading.Thread(target=sleep,  args=(num, answer_list))
        thread.start()
    while (threading.active_count() > 1):
        time.sleep(0.1)
    print answer_list


def sleep(num, lis):
    time.sleep(num * 0.1)
    lis.append(num)


if __name__ == "__main__":
    sort(sort_list)

ayahito2828
お仕事では主にDjango・Pythonを書いてます。最近はちょこちょこGo言語を勉強中。一番好きな本はScheme手習いです
http://d.hatena.ne.jp/ayahito2828/
Why not register and get more from Qiita?
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away