#!/ur/bin/env python
__author__ = "lynn lin"
__lience__ = "MIT"
class queue(object):
def __init__(self):
self.que = []
def __len__(self):
return len(self.que)
def QueueEmpty(self):
return self.__len__()
def EnQueue(self,value):
self.que.insert(0,value)
def DeQueue(self):
try:
return self.que.pop()
except:
raise UnderFlowError,"queue is empty,no value to pop"
def has_key(self,value):
if value in self.que:
return True
else:
return False
|