23 lines
381 B
Python
23 lines
381 B
Python
|
|
||
|
__author__="bjschuma"
|
||
|
__date__ ="$Feb 22, 2010 10:52:13 PM$"
|
||
|
|
||
|
|
||
|
# This is a sorted list (as long as items are inserted with add() )
|
||
|
class Slist(list):
|
||
|
def __init__(self):
|
||
|
list.__init__(self)
|
||
|
|
||
|
|
||
|
def add(self, item, priority):
|
||
|
self += [(priority,item)]
|
||
|
self.sort()
|
||
|
|
||
|
|
||
|
def remove(self, item):
|
||
|
for tuple in self:
|
||
|
if tuple[1] == item:
|
||
|
list.remove(self,tuple)
|
||
|
break
|
||
|
|