Created
September 25, 2014 02:18
-
-
Save hlxwell/4d04df3d92afc0403392 to your computer and use it in GitHub Desktop.
Python test
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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