循环双端列表链表append问题
71n9 opened this issue · comments
dll = CirculateDoubleLinkedList()
此时maxsize = None 使用append方法 和appendleft 还是可以添加
append方法里面没有抛出异常
if self.maxsize is not None and len(self) > self.maxsize:
raise Exception("full")
改成下面代码就可以限制
if self.maxsize is None or len(self) >= self.maxsize:
raise Exception("full")