sleep_sort をgeventで書いてみる
はじめに
sleep_sortをgeventを使って書いてみました。
初めて使ってみましたので、間違い/突っ込みなどありましたら是非よろしくお願いします。
ソース
実行
$ python2.7 -m doctest sleep_sort.py -v
Trying:
sleep_sort([])
Expecting:
[]
ok
Trying:
sleep_sort([9, 4, 3, 6, 7, 8, 2, 5, 1, 10])
Expecting:
[1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
ok
1 items had no tests:
sleep_sort
1 items passed all tests:
2 tests in sleep_sort.sleep_sort
2 tests in 2 items.
2 passed and 0 failed.
Test passed.