📄 defer-examples.py
字号:
def printResult(x): print 'result:',x# remote method callremoteObject.callRemote("test").addCallback(printResult)# database interactiondbInterface.runQuery("select * from random_table").addCallback(printResult)# threadpool executiondef myMethod(a, b, c): return a + b + cdeferToThread(myMethod, 1, 2, 3).addCallback(printResult)# Remote method calls that invoke a database connection and wait until the# database is done returning its query before turning the query into a string# and then sending the string as the result of the remote method call.class MyClass(Referenceable): def remote_doIt(self): return self.databaseConnector.runQuery( "select * from foo").addCallback(str)
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -