class Runner: """ information of registered runners Attributes: @type email: str email of the registered runner @type category: str the speed they estimate that they can finish the race @type list: clist the list of runners in the same category """ under_twenty_min = [] under_thirty_min = [] under_forty_min = [] forty_and_above = [] def __init__(self, email, category): """Register the email and the speed estimation of runners @type self: Runner @type email: str @type speed: int @type category:str @type clist: list @rtype: list >>>runner1=Runner('[email protected]','under 40 min') >>>runner1.email '[email protected]' >>>runner1.category 'under 40 min' """ self.email = email self.category = category if category=='under 20 min': self.clist=under_twenty_min elif category=='under 30 min': self.clist = under_twenty_min elif category=='under 40 min': self.clist = under_forty_min elif category=='40 min and over': self.clist = forty_and_over renew(self,clist) return clist basically i have to return a list of runners with the same speed category when initialize a runner, but I can't assign the lists I defined above to the class attribute, is there anyway to fix it?
self.clist=Runner.under_twenty_minreturn clist-->return self.clistandrenew(self,clist)-->renew(self,self.clist). You should probably show usrenew- is it a method of the class or a standalone function?