>>> from plib.stdlib import SortMixin
>>> class SortList(SortMixin, list):
...     pass
... 
>>> def build_sortlist(l1, l2):
...     for item in l1:
...         l2.insert_sorted(item)
...         print l2
... 
>>> l1 = ['c', 'b', 'e', 'a', 'd']
>>> l2 = SortList()
>>> build_sortlist(l1, l2)
['c']
['b', 'c']
['b', 'c', 'e']
['a', 'b', 'c', 'e']
['a', 'b', 'c', 'd', 'e']
>>> l2 == sorted(l1)
True
>>> l1 = [3, 2, 5, 1, 4]
>>> l2 = SortList()
>>> build_sortlist(l1, l2)
[3]
[2, 3]
[2, 3, 5]
[1, 2, 3, 5]
[1, 2, 3, 4, 5]
>>> l2 == sorted(l1)
True
>>> l1 = [222, 1300, 51, 7, 411]
>>> l2 = SortList()
>>> build_sortlist(l1, l2)
[222]
[222, 1300]
[51, 222, 1300]
[7, 51, 222, 1300]
[7, 51, 222, 411, 1300]
>>> l2 == sorted(l1)
True
>>> def testcmp(x, y):
...     return cmp(str(x), str(y))
... 
>>> def build_sortlist2(l1, l2):
...     for item in l1:
...         l2.insert_sorted(item, testcmp)
...         print l2
... 
>>> l1 = [1300, 222, 51, 7, 411]
>>> l2 = SortList()
>>> build_sortlist2(l1, l2)
[1300]
[1300, 222]
[1300, 222, 51]
[1300, 222, 51, 7]
[1300, 222, 411, 51, 7]
>>> l2 == sorted(l1, testcmp)
True
