python闭包
2016-07-25 20:13
369 查看
lexical closure,f1的主要目的为f2提供运行环境
In [22]: def f1(x): ....: def f2(y): ....: return x*y ....: return f2 ....: In [23]: f = f1(3) In [24]: f(4) Out[24]: 12 In [25]: f(5) Out[25]: 15 In [26]: f(6) Out[26]: 18
相关文章推荐
- 习题24 更多练习
- python+Myeclipse2014+pymongo+NLTK
- PYTHON_IN_ML
- Python初级简易爬虫
- Python安装模块出错(ImportError: No module named set***)解决方法
- Python最常用的正则表达式
- Python3.4文件目录操作
- Python(基本输入输出)
- Python 之 日志logging 之 2
- python3.5安装lxml库
- 算法导论习题2-4 Inversions 逆序数
- 用python实现webshark(实现web版的wireshark功能)
- 【转】学习Python的19个资源
- python 批量远程执行SQL SERVER 脚本
- python批量制作雷达图
- python 使用socket搭建简单服务器
- python gzip模块
- pip install 卡住不动的解决方案
- Python 安装requests包问题解决
- leetcode-python 第五周