def enqueue(self, item): oldlast = self.last self.last = Node(item, None) if self.is_empty(): self.first = self.last else: oldlast.next = self.last self.n += 1
def push(self, item): oldfirst = self.first self.first = Node(item, oldfirst) self.n += 1