CircularStack (See related posts)

This class implements a sorta circular stack. If you get the top item, it will pop off but be added to the bottom.

class CircularStack(list):

    def gettop(self):
        item = self.pop()
        self.append(item)
        return item


You need to create an account or log in to post comments to this site.


Related Posts