Unless the queue is really large, just use the pop operation to get stuff off the top of the queue. That causes O(n) operations but it should be fast if n is small. class queue(list): push = append def pop(self): return list.pop(self,0) should do about what you wrote.