Tornado 4.5 Documentation
import gen @gen.coroutine def fetch_coroutine(url): http_client = AsyncHTTPClient() response = yield http_client.fetch(url) raise gen.Return(response.body) The statement raise gen.Return(response Coroutines are the recommended way to write asynchronous code in Tornado. Coroutines use the Python yield keyword to suspend and resume execution instead of a chain of callbacks (cooperative lightweight threads import gen @gen.coroutine def fetch_coroutine(url): http_client = AsyncHTTPClient() response = yield http_client.fetch(url) # In Python versions prior to 3.3, returning a value from # a generator0 码力 | 333 页 | 322.34 KB | 1 年前3
Tornado 5.1 Documentation
the IOLoop that use callbacks. Futures are usually transformed into their result with the await or yield keywords. Examples Here is a sample synchronous function: from tornado.httpclient import HTTPClient import gen @gen.coroutine def async_fetch_gen(url): http_client = AsyncHTTPClient() response = yield http_client.fetch(url) raise gen.Return(response.body) Coroutines are a little magical, but what are the recommended way to write asynchronous code in Tornado. Coroutines use the Python await or yield keyword to suspend and resume execution instead of a chain of callbacks (cooperative lightweight threads0 码力 | 359 页 | 347.32 KB | 1 年前3
Tornado 6.2 Documentation
the IOLoop that use callbacks. Futures are usually transformed into their result with the await or yield keywords. Examples Here is a sample synchronous function: from tornado.httpclient import HTTPClient import gen @gen.coroutine def async_fetch_gen(url): http_client = AsyncHTTPClient() response = yield http_client.fetch(url) raise gen.Return(response.body) Coroutines are a little magical, but what “native coroutines”). For compatibility with older versions of Python, you can use “decorated” or “yield-based” coroutines using the tornado.gen.coroutine decorator. Native coroutines are the recommended0 码力 | 407 页 | 385.03 KB | 1 年前3
Tornado 6.0 Documentation
the IOLoop that use callbacks. Futures are usually transformed into their result with the await or yield keywords. Examples Here is a sample synchronous function: from tornado.httpclient import HTTPClient import gen @gen.coroutine def async_fetch_gen(url): http_client = AsyncHTTPClient() response = yield http_client.fetch(url) raise gen.Return(response.body) Coroutines are a little magical, but what are the recommended way to write asynchronous code in Tornado. Coroutines use the Python await or yield keyword to suspend and resume execution instead of a chain of callbacks (cooperative lightweight threads0 码力 | 869 页 | 692.83 KB | 1 年前3
Tornado 6.1 Documentation
the IOLoop that use callbacks. Futures are usually transformed into their result with the await or yield keywords. Examples Here is a sample synchronous function: from tornado.httpclient import HTTPClient import gen @gen.coroutine def async_fetch_gen(url): http_client = AsyncHTTPClient() response = yield http_client.fetch(url) raise gen.Return(response.body) Coroutines are a little magical, but what are the recommended way to write asynchronous code in Tornado. Coroutines use the Python await or yield keyword to suspend and resume execution instead of a chain of callbacks (cooperative lightweight threads0 码力 | 931 页 | 708.03 KB | 1 年前3
Tornado 6.4 Documentation
the IOLoop that use callbacks. Futures are usually transformed into their result with the await or yield keywords. Examples Here is a sample synchronous function: from tornado.httpclient import HTTPClient import gen @gen.coroutine def async_fetch_gen(url): http_client = AsyncHTTPClient() response = yield http_client.fetch(url) raise gen.Return(response.body) Coroutines are a little magical, but what “native coroutines”). For compatibility with older versions of Python, you can use “decorated” or “yield-based” coroutines using the tornado.gen.coroutine decorator. Native coroutines are the recommended0 码力 | 432 页 | 402.58 KB | 1 年前3
Tornado 6.4 Documentation
the IOLoop that use callbacks. Futures are usually transformed into their result with the await or yield keywords. Examples Here is a sample synchronous function: from tornado.httpclient import HTTPClient import gen @gen.coroutine def async_fetch_gen(url): http_client = AsyncHTTPClient() response = yield http_client.fetch(url) raise gen.Return(response.body) Coroutines are a little magical, but what “native coroutines”). For compatibility with older versions of Python, you can use “decorated” or “yield-based” coroutines using the tornado.gen.coroutine decorator. Native coroutines are the recommended0 码力 | 432 页 | 402.58 KB | 1 年前3
Tornado 6.4 Documentation
the IOLoop that use callbacks. Futures are usually transformed into their result with the await or yield keywords. Examples Here is a sample synchronous function: from tornado.httpclient import HTTPClient import gen @gen.coroutine def async_fetch_gen(url): http_client = AsyncHTTPClient() response = yield http_client.fetch(url) raise gen.Return(response.body) Coroutines are a little magical, but what “native coroutines”). For compatibility with older versions of Python, you can use “decorated” or “yield-based” coroutines using the tornado.gen.coroutine decorator. Native coroutines are the recommended0 码力 | 432 页 | 402.58 KB | 1 年前3
Tornado 6.3 Documentation
the IOLoop that use callbacks. Futures are usually transformed into their result with the await or yield keywords. Examples Here is a sample synchronous function: from tornado.httpclient import HTTPClient import gen @gen.coroutine def async_fetch_gen(url): http_client = AsyncHTTPClient() response = yield http_client.fetch(url) raise gen.Return(response.body) Coroutines are a little magical, but what “native coroutines”). For compatibility with older versions of Python, you can use “decorated” or “yield-based” coroutines using the tornado.gen.coroutine decorator. Native coroutines are the recommended0 码力 | 423 页 | 398.18 KB | 1 年前3
Tornado 6.5 Documentationthe IOLoop that use callbacks. Futures are usually transformed into their result with the await or yield keywords. Examples Here is a sample synchronous function: from tornado.httpclient import HTTPClient gen @gen.coroutine def async_fetch_gen(url): http_client = AsyncHTTPClient() response = yield http_client.fetch(url) raise gen.Return(response.body) Coroutines are a little magical, but “native coroutines”). For compatibility with older versions of Python, you can use “decorated” or “yield-based” coroutines using the tornado.gen.coroutine decorator. Native coroutines are the recommended0 码力 | 437 页 | 405.14 KB | 3 月前3
共 313 条
- 1
- 2
- 3
- 4
- 5
- 6
- 32













