Q:

Why can't I concatenate these?

 class Pet:

def __init__(self, name, age):
    self.name = name
    self.age = age

def talk(self):
    raise NotImplementedError("Subclass must implement abstract method")

class Cat(Pet):

def __init__(self, name, age):
    Pet.__init__(self, name, age)

def talk(self):
    return "Meowww"

class Dog(Pet):

    def __init__(self, name, age):
        Pet.__init__(self, name, age)

    def talk(self):
        return "Woof"

def main ():

    pets = [Cat("Jess",3),Dog("Riker",2),Cat("Fred",7),Pet("thePet",5)]

    for pet in pets:
        print "Name: " + pet.name + "Age: " + str(pet.age) + ", says: " + pet.talk

    print jess.name

if __name__ == "__main__":
    main()

Traceback (most recent call last):
File "pets.py", line 36, in <module
main()
File "pets.py", line 31, in main
    print "Name: " + pet.name + "Age: " + str(pet.age) + ", says: " + pet.talk
TypeError: cannot concatenate 'str' and 'instancemethod' objects

Well, I hope that pasted correctly. I know that I need to convert the type int to str, but I don't know about why it can't concatenate with an "instancemethod." I've searched around and most other posts deal with converting int to str or whatever which are simple formatting errors. I am following this tutorial on Youtube and I've looked at it again and again and I'm pretty sure that my code is formatted correctly and matches the tutorials. Maybe I'm just missing something obvious, would really appreciate another pair of eyes on this one.

A:

You must concatenate it with the result (value returned) of that method. How do you get this result? You must call the method passing the parameters inside (...). For example:
print "Name: " + ... + pet.talk()

