思考题的提问
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', 99), Student('Bob', 88), 100, 'Hello']
K=map(lambda L:L if isinstance(L,Student),L) 最后这个语句为什么错了啊?if 不能和INSTANCE连用吗