哪里错了,为啥总这样,快疯了,求帮忙
class Student(object):
def __init__(self,name,score):
self.name=name
self.score=score
def __str__(self):
return '%s:%s'%(self.name,self.score)
__repr__=__str__
def __cmp__(self, s):
if self.name < s.name:
return -1
elif self.name > s.name:
return 1
else:
return 0
L = [Student('Tim',89),Student('Alice',69),Student('Jim',79)]
print sorted(L)
哪里错了,为啥总这样,快疯了,求帮忙