Skip to content

Instantly share code, notes, and snippets.

@hlxwell
Created September 25, 2014 02:18
Show Gist options
  • Save hlxwell/4d04df3d92afc0403392 to your computer and use it in GitHub Desktop.
Save hlxwell/4d04df3d92afc0403392 to your computer and use it in GitHub Desktop.
Python test
class Animal(object):
def __init__(self):
self.name = "Animal"
def eat(self, food = "nothing"):
print self.name + " eats " + food
# ==================================================
import animal
class Dog(animal.Animal):
def __init__(self):
super(animal.Animal, self).__init__()
self.name = "Dog"
def eat(self, word):
return word + ","
def talk(self, words):
print "".join(map(self.eat, words))
d = Dog()
d.talk(["a", "b", "c"])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment