Python __call__
来源:互联网 发布:一维数组排序算法 php 编辑:程序博客网 时间:2024/05/15 02:19
__new__ 用于生成类本身
__call__用于生成类的实例
class Meta(type): def __new__(cls, name, bases, newattrs): print "new: %r %r %r %r" % (cls, name, bases, newattrs,) return super(Meta, cls).__new__(cls, name, bases, newattrs) def __call__(self, *args, **kw): print "call: %r %r %r" % (self, args, kw) #return None return super(Meta, self).__call__(*args, **kw) def __init__(cls, name, bases, dict): super(Meta, cls).__init__(name, bases, dict) cls._instance = None print 'TTTTTTTTTTTTTTTTTTT'class Foo: __metaclass__ = Meta def __init__(self, *args, **kw): print "init: %r %r %r" % (self, args, kw)f = Foo('bar')print "main: %r" % f
0 0
- Python __call__
- python __call__
- Python __call__
- python __call__
- Python __call__
- python的__call__
- [Python小菜]__call__是什么
- python __call__ 函数
- Python __new__ ,__init__,__call__
- python的__call__
- Python中的__init__,__call__
- Python中的__init__,__call__
- python __call__ 函数
- python的__call__方法
- python的__call__函数
- python __init__ __new__ __call__
- python __call__ 函数
- python __new__、__init__、__call__
- Android开发之Activity详解一
- 第七周项目四友元类
- JAVA多线程编程详解-详细操作例子
- 3Sum Closest
- JS获取单元格所在行
- Python __call__
- HTML Forms & Form element
- 同源策略以及cookie安全策略
- HTML笔记——背景&颜色
- 在使用了Maven后出现了There is no Action mapped for namespace [/] and action name [*] associated with context
- 简单opencv人脸检测代码:LBP/Haar特征
- 仿SlidingMenu
- [PB]-大文本(Blob)对象处理
- VB6.0工具的使用