Here is a class called PriorityQueue: class PriorityQueue: def __init__(self): self.items = [] def isEmpty(self): return self.items == [] def insert(self, item): self.items.append(item) def remove(self): maxi = 0 for i in range(1, len(self.items)): if self.items[i] > self.items[maxi]: maxi = i item = self.items[maxi] return item My question concerns the remove function. The function returns the maximum value. However, I'm curious about self.items[maxi:maxi+1] = []. I understand that the programmer wants to remove self.items[maxi]. Why would he or she want to remove that value and the one next to it (maxi+1)? Or am I misunderstanding self.items[maxi:maxi+1] = [] ?
As an aside, I can't figure out how to respond to topics on this list. _______________________________________________ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor