Skip to content

Instantly share code, notes, and snippets.

@offby1
Created July 19, 2015 02:55
Show Gist options
  • Select an option

  • Save offby1/52ca7be4b78a1a91f786 to your computer and use it in GitHub Desktop.

Select an option

Save offby1/52ca7be4b78a1a91f786 to your computer and use it in GitHub Desktop.
class Cat(object):
def __init__(self):
self.tummy = []
def eat(self, thing):
self.tummy.append(thing)
def hairball(self):
print("I puked up a {}".format(self.tummy.pop()))
snowball = Cat()
snowball.eat('fish')
snowball.eat('shoelace')
snowball.hairball()
snowball.hairball()
# I puked up a shoelace
# I puked up a fish
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment