Class attributes newbie question (before I join a cargocult)

mattjfleming at googlemail.com mattjfleming at googlemail.com
Sun Mar 12 19:54:30 CET 2006


Should't the changeSex method be:

def changeSex(self, newsex=""):
    self.sex = newsex
    return self.sex


You're creating a new instance variable at the moment i.e 'self.mysex'
doesn't exist until you call changeSex.




More information about the Python-list mailing list