class Closure(): def set_passline(self, passline): def cmp(val): if val >= passline: print('success') else: print('failed') return cmp if __name__ == '__main__': f = Closure().set_passline(89) f(88)
python闭包
最新推荐文章于 2024-02-04 15:49:23 发布
class Closure(): def set_passline(self, passline): def cmp(val): if val >= passline: print('success') else: print('failed') return cmp if __name__ == '__main__': f = Closure().set_passline(89) f(88)