functools 模块partial方法使用
2013-11-05 23:17
337 查看
partial 固定函数的局部参数
from functools import * def test_func(arg1, arg2): return arg1+arg2 partial_test_func = partial(test_func, 1) #给第一个参数设置默认值1 print test_func(1,2) print partial_test_func(2) #其实效果和上面的一样 print type(test_func) print type(partial_test_func)
相关文章推荐
- functools.partial 的使用
- Python optionParser模块的使用方法
- python标准日志模块logging的使用方法
- AMD异步模块定义介绍和Require.js中使用jQuery及jQuery插件的方法
- 在Python中使用glob模块查找文件路径的方法
- 201505081329_《Javascript的三种使用模块方法》
- python 使用相对路径import 模块的方法
- Swift_方法func(在类、枚举、结构体中的声明和使用 mutating func初始化值可变)
- PHP函数详解:call_user_func()使用方法
- python标准日志模块logging的使用方法
- 【Python模块】functools —— 作用于可调用对象的高阶函数集合
- python使用xlrd模块读写Excel文件的方法
- Python中functools模块的常用函数解析
- Python中pandas模块的使用方法
- [原] XAF使用审计模块的对象避免数据冗余的方法
- 详解Python中使用base64模块来处理base64编码的方法
- PYTHON-进阶-FUNCTOOLS模块小结
- scikit-learn主要模块和基本使用方法
- python 的日志logging模块使用方法
- python使用xlrd模块读写Excel文件的方法