Skip to content

Instantly share code, notes, and snippets.

@SamuraiT
Created March 2, 2014 16:34
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save SamuraiT/9309183 to your computer and use it in GitHub Desktop.
Save SamuraiT/9309183 to your computer and use it in GitHub Desktop.
class DictFifo(object):
def __init__(self):
self.nextin = 0
self.nextout = 0
self.data = {}
def append(self, value):
self.data[self.nextin] = value
self.nextin += 1
def pop(self, n=-1):
value = self.data.pop(self.nextout)
self.nextout += 1
return value
def __str__(self):
return str(self.data)
__repr__ = __str__
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment