错误写法
class RemoteHandler(web.RequestHandler):
@gen.coroutine
def get(self):
response = httpclient('http://www.baidu.com')
self.write(response.body)
@gen.coroutine
def httpClient(url):
result = yield httpclient.AsyncHTTPClient().fetch(url)
return result
按照一般的方法return会报错
需要使用 raise gen.Return(response.body) 代替return
立即学习“Python免费学习笔记(深入)”;
大高朋团购系统是一套Groupon模式的开源团购程序,开发的一套网团购程序,系统采用ASP+ACCESS开发的团购程序,安装超简,功能超全面,在保留大高朋团购系统版权的前提下,允许所有用户免费使用。大高朋团购系统内置多种主流在线支付接口,所有网银用户均可无障碍支付;短信发送团购券和实物团购快递发货等。 二、为什么选择大高朋团购程序系统? 1.功能强大、细节完善 除了拥有主流团购网站功能,更特别支
官方例子
@gen.coroutine
def fetch_json(url):
response = yield AsyncHTTPClient().fetch(url)
raise gen.Return(json_decode(response.body))
In Python 3.3, this exception is no longer necessary: the return statement can be used directly to return a value (previously yield and return with a value could not be combined in the same function).
在python 3.3以上版本, 不在需要抛出异常,可以直接使用return直接返回值。而在之前的版本中,yield和带有返回值的return不能处于一个函数当中。










