Tornado 6.5 DocumentationAsyncHTTPClient() my_future = Future() fetch_future = http_client.fetch(url) def on_fetch(f): my_future.set_result(f.result().body) fetch_future.add_done_callback(on_fetch) return my_future Notice that the that yields Queue.get pauses until there is an item in the queue. If the queue has a maximum size set, a coroutine that yields Queue.put pauses until there is room for another item. A Queue maintains url_seeker.urls async def main(): q = queues.Queue() start = time.time() fetching, fetched, dead = set(), set(), set() async def fetch_url(current_url): if current_url in fetching: return print("fetching %s"0 码力 | 272 页 | 1.12 MB | 3 月前3
Tornado 6.5 DocumentationAsyncHTTPClient() my_future = Future() fetch_future = http_client.fetch(url) def on_fetch(f):my_future.set_result(f.result().body) fetch_future.add_done_callback(on_fetch) return my_future Notice that yields Queue.get pauses until there is an item in the queue. If the queue has a maximum size set, a coroutine that yields Queue.put pauses until there is room for another item. A Queue maintains async def main(): q = queues.Queue() start = time.time() fetching, fetched, dead = set(), set(), set() async def fetch_url(current_url): if current_url in fetching: return0 码力 | 437 页 | 405.14 KB | 3 月前3
Julia 1.11.4Dictionaries . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 773 43.7 Set-Like Collections . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 789 43.8 Dequeues mathematical use. More precisely, the set of all finite-length strings S together with the string concatenation operator * forms a free monoid (S, *). The identity element of this set is the empty string, "". Whenever (y, x) : (x, y) julia> gap((min, max)) = max - min julia> gap(minmax(10, 2)) 8 Notice the extra set of parentheses in the definition of gap. Without those, gap would be a two-argument function, and0 码力 | 2007 页 | 6.73 MB | 3 月前3
Julia 1.11.5 DocumentationDictionaries . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 773 43.7 Set-Like Collections . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 789 43.8 Dequeues mathematical use. More precisely, the set of all finite-length strings S together with the string concatenation operator * forms a free monoid (S, *). The identity element of this set is the empty string, "". Whenever (y, x) : (x, y) julia> gap((min, max)) = max - min julia> gap(minmax(10, 2)) 8 Notice the extra set of parentheses in the definition of gap. Without those, gap would be a two-argument function, and0 码力 | 2007 页 | 6.73 MB | 3 月前3
Julia 1.11.6 Release NotesDictionaries . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 773 43.7 Set-Like Collections . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 789 43.8 Dequeues mathematical use. More precisely, the set of all finite-length strings S together with the string concatenation operator * forms a free monoid (S, *). The identity element of this set is the empty string, "". Whenever (y, x) : (x, y) julia> gap((min, max)) = max - min julia> gap(minmax(10, 2)) 8 Notice the extra set of parentheses in the definition of gap. Without those, gap would be a two-argument function, and0 码力 | 2007 页 | 6.73 MB | 3 月前3
julia 1.13.0 DEVDictionaries . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 808 44.7 Set-Like Collections . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 824 44.8 Dequeues mathematical use. More precisely, the set of all finite-length strings S together with the string concatenation operator * forms a free monoid (S, *). The identity element of this set is the empty string, "". Whenever = max - min gap (generic function with 1 method) julia> gap(minmax(10, 2)) 8 Notice the extra set of parentheses in the definition of gap. Without those, gap would be a two-argument function, and0 码力 | 2058 页 | 7.45 MB | 3 月前3
Julia 1.12.0 RC1Dictionaries . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 806 44.7 Set-Like Collections . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 822 44.8 Dequeues mathematical use. More precisely, the set of all finite-length strings S together with the string concatenation operator * forms a free monoid (S, *). The identity element of this set is the empty string, "". Whenever (y, x) : (x, y) julia> gap((min, max)) = max - min julia> gap(minmax(10, 2)) 8 Notice the extra set of parentheses in the definition of gap. Without those, gap would be a two-argument function, and0 码力 | 2057 页 | 7.44 MB | 3 月前3
Julia 1.12.0 Beta4Dictionaries . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 805 44.7 Set-Like Collections . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 821 44.8 Dequeues mathematical use. More precisely, the set of all finite-length strings S together with the string concatenation operator * forms a free monoid (S, *). The identity element of this set is the empty string, "". Whenever (y, x) : (x, y) julia> gap((min, max)) = max - min julia> gap(minmax(10, 2)) 8 Notice the extra set of parentheses in the definition of gap. Without those, gap would be a two-argument function, and0 码力 | 2057 页 | 7.44 MB | 3 月前3
Julia 1.12.0 Beta3Dictionaries . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 805 44.7 Set-Like Collections . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 821 44.8 Dequeues mathematical use. More precisely, the set of all finite-length strings S together with the string concatenation operator * forms a free monoid (S, *). The identity element of this set is the empty string, "". Whenever (y, x) : (x, y) julia> gap((min, max)) = max - min julia> gap(minmax(10, 2)) 8 Notice the extra set of parentheses in the definition of gap. Without those, gap would be a two-argument function, and0 码力 | 2057 页 | 7.44 MB | 3 月前3
julia 1.12.0 beta1Dictionaries . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 797 43.7 Set-Like Collections . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 813 43.8 Dequeues mathematical use. More precisely, the set of all finite-length strings S together with the string concatenation operator * forms a free monoid (S, *). The identity element of this set is the empty string, "". Whenever (y, x) : (x, y) julia> gap((min, max)) = max - min julia> gap(minmax(10, 2)) 8 Notice the extra set of parentheses in the definition of gap. Without those, gap would be a two-argument function, and0 码力 | 2047 页 | 7.41 MB | 3 月前3
共 29 条
- 1
- 2
- 3













