易截截图软件、单文件、免安装、纯绿色、仅160KB

关于python class: callerRef的问题

Python code:

class A:
def __init__(self):
self.B_Handle = B_Handle
self.VA = "A_init"
print "Class A init"
def __getattr__(self, name):
print "A.__getattr__"
print "name=%s" % name
def callref(self, callref="A",):
print "A.callref = %s" % callref
return self.B_Handle.callref(self, callref)
class B:
def __init__(self):
self.VB = "B_init"
print self.VB
def callref(self, [color=#FF0000]callerRef,[/color] callref):
print "B.callref = %s" % callref
B_Handle = B()

if __name__ == "__main__":
print "eval callerRef start"
a = A()
a.callref()


运行结果:
>>> B_init
eval callerRef start
Class A init
A.callref = A
B.callref = A

看到一段这样的代码, 对其中的callerRef不是很理解,请高手指点!
重发class B 代码:
Python code:

class B:
def __init__(self):
self.VB = "B_init"
print self.VB
def callref(self, [color=#FF0000]callerRef,[/color] callref):
print "B.callref = %s" % callref





相关问答:

python PIL模块打开图片问题

请问下,我的是python2.5安装了PIL模块,然后编写程序打开本机上的一个图片时,为什么老出现错误呢,老是找不到图片,错误提示如下:File "C:\Python25\Lib\site-packages\PIL\Image.py", line 1888, in o ......

python正则表达式 如何取出以下字符串 多谢

s='aaa111aaa,bbb222,333ccc,444ddd444,555eee666,fff777ggg'
用正则表达式取出 前后字母相同的数据 结果如下:
111 ddd
谢谢~
Python code:

import re
s='aaa111aaa,bbb222,333ccc,444ddd444,555eee666,ff ......

Python 怎样启动远程的QTP?

Python 怎样启动远程的QTP,然后执行某个路径下的TEST ?

VB可以这样:
Set qtApp = CreateObject("QuickTest.Application", "192.168.0.102")
qtApp.Launch
qtApp.Visible = T ......

【求助】python传系统参数无法传入,急!

我在批处理中调用python脚本
如下:
call %pyscript%\StaticResult.py -s D:\DailySDV\Bts8.1\TestLog\TestResult.xml -d %CiRoot_WndPath%\cruisecontrol\userData\groups\group01\projects\%ProjectName%\%GtrRl ......

Python 中如何写if

python

content=str.find('ok')  &&  content=str.find('not ok')

这样表示 在内容中找到 ok  或者 找到 not ok 对吗?
并列条件用 and 而不是&& ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号