一些python
来源:互联网 发布:流程优化5w1h 编辑:程序博客网 时间:2024/06/16 14:26
1.协程(Coroutine)
2.@修饰符(decorator)
3. @classmethod和@staticmethod
4.*arg,**arg
5.继承/多重继承中的参数传递
http://canx.me/2011/12/%E4%B8%80%E4%BA%9Bpython/
关于继承/多重继承中的参数传递
class Service(object): def __init__(self, host, binary, topic, manager, report_interval=None, periodic_interval=None, *args, **kwargs): print 'Initializing Service'print kwargsprint args super(Service, self).__init__(*args, **kwargs) print 'Service: ' + binary, args, kwargsclass Color(object): def __init__(self, color='red', **kwargs): print 'Initializing Color' self.color = colorprint kwargs super(Color, self).__init__(**kwargs) print 'Color: ', kwargsclass ColoredService(Service, Color): def __init__(self, *args, **kwds): print 'Initializing Colored Service' super(ColoredService, self).__init__(*args, **kwds)c = ColoredService('host', 'bin', 'top', 'mgr', 'ivl', color='blue')输入结果如下所示:
sina@ubuntu:~/TestDir$ python service.py Initializing Colored ServiceInitializing Service{'color': 'blue'}()Initializing Color{}Color: {}Service: bin () {'color': 'blue'}
- 一些python
- Python 一些函数介绍
- Python 一些语法规则
- python的一些笔记
- 一些Python-SSL modules
- Python一些扩展模块
- 一些python入门代码
- Python中的一些异常
- python 一些资源
- python一些问题
- python 的一些知识点
- Python中的一些函数
- python的一些注意
- Python一些知识
- python的一些基础知识
- Python的一些优势
- Python的一些特性
- Python的一些笔记
- 设计模式(七)装饰者和观察者模式
- css expression辅助在IE6下实现划线效果
- NSArray汇总
- struts导入源码以及帮助文档
- 将ASP.NET MVC 部署在IIS6和IIS7
- 一些python
- そんなsplayで大丈夫が?
- 求职那些事二
- Git-daemon setup (running under xined)
- java的发展史——JDK各版的发布时间表
- 《JavaWeb---防恶意注册应用---输出随机验证图片》
- 第三周 任务2.1 C#猜数字
- hdu 1035 Robot Motion
- 排序算法总结(3)——交换排序