Skip to content

Instantly share code, notes, and snippets.

@ecarreras
Created December 12, 2013 09:48
Show Gist options
  • Save ecarreras/7925554 to your computer and use it in GitHub Desktop.
Save ecarreras/7925554 to your computer and use it in GitHub Desktop.
Simple utility to pop n elements
class Popper(object):
def __init__(self, items):
self.items = items[:]
def pop(self, n):
res = []
for x in xrange(0, min(n, len(self.items))):
res.append(self.items.pop())
return res
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment