« Newer Snippets
Older Snippets »
1 total  XML / RSS feed 

CircularStack

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

« Newer Snippets
Older Snippets »
1 total  XML / RSS feed