List append help

Bill Bill
Sun Mar 14 08:05:14 CET 2004

I am trying to do an exercise in an online tutorial that but the tutorial
does not list the solution. Could someone please tell me why the "hireCrew"
method in the following code leaves me with a list that contains "None"? Be
nice, this is my first go at this, thanks!

class Organization:
    def __init__(self, argName, argLeader, argCrew):
        self.myName = argName
        self.myLeader = argLeader
        self.myCrew = argCrew

    def getName(self):
        return self.myName

    def setLeader(self, argLeader):
        self.myLeader = argLeader

    def getLeader(self):
        return self.myLeader

    def getCrew(self):
        return self.myCrew

    def hireCrew(self, argHire):
        self.myCrew = self.myCrew.append(argHire)
        return self.myCrew

x = Organization("MyOrg", "JB", ["TL", "BK"])
print x.getName(), x.getLeader(), x.getCrew()
print x.getName(), x.getLeader(), x.getCrew()

More information about the Python-list mailing list