Skip to content

Instantly share code, notes, and snippets.

@gennad
Created March 6, 2011 11:19
Show Gist options
  • Save gennad/857211 to your computer and use it in GitHub Desktop.
Save gennad/857211 to your computer and use it in GitHub Desktop.
Stack
class Stack:
def __init__(self):
self.stack = []
def push(self, el):
self.stack.append(el)
def pop(self):
if len(self.stack) == 0:
raise StackEmptyError()
def size(self):
return len(self.stack)
class StackEmptyError(Error):
pass
stack = Stack()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment