标签:
# -*- coding: utf-8 -*- #python 27 #xiaodeng #Python之闭包 #http://python.jobbole.com/82624/ #闭包:函数是一个对象,所以可以作为某个函数的返回结果 def line_conf(): def line(x): return 2*x+1 return line#line_conf的返回结果被赋给line对象 MyLine = line_conf() print MyLine(5)#11 print ‘**‘*20 def make_adder(addend): def adder(augend): return augend + addend return adder p = make_adder(23) print p(100)#123
标签:
原文地址:http://www.cnblogs.com/dengyg200891/p/4943904.html