python3.4報錯'NoneType' object is not callable >>>
def set_passline(passline):
? ? def cmp(va):
? ? ? ? if va>=passline:
? ? ? ? ? ? print('pass')
? ? ? ? else:
? ? ? ? ? ? print ('failed')
? ? ? ? return cmp
fun_100 = set_passline(60)
fun_150 = set_passline(90)
fun_100(89)
fun_150(89)
2017-11-22
return cmp 和def cmp(val): 這行對齊
2017-07-19
return cmp 應該是set_passline的返回值,而不應該是閉包cmp的返回值