Tornado 6.0 Documentation
href = dict(attrs).get("href") if href and tag == "a": self.urls.append(href) url_seeker = URLSeeker() url_seeker.feed(html) return url_seeker.urls async def multi(list_of_futures) is equivalent to: results = [] for future in list_of_futures: results.append(yield future) If any children raise exceptions, multi() will raise the first one. All others will tornado.options options with multiple=True that are set more than once now overwrite rather than append. This makes it possible to override values set in parse_config_file with parse_command_line. tornado0 码力 | 869 页 | 692.83 KB | 1 年前3
Tornado 6.1 Documentation
href = dict(attrs).get("href") if href and tag == "a": self.urls.append(href) url_seeker = URLSeeker() url_seeker.feed(html) return url_seeker.urls async def multi(list_of_futures) is equivalent to: results = [] for future in list_of_futures: results.append(yield future) If any children raise exceptions, multi() will raise the first one. All others will tornado.options options with multiple=True that are set more than once now overwrite rather than append. This makes it possible to override values set in parse_config_file with parse_command_line. tornado0 码力 | 931 页 | 708.03 KB | 1 年前3
Hello 算法 1.0.0b4 Python版。 # === File: list.py === # 清空列表 list.clear() # 尾部添加元素 list.append(1) list.append(3) list.append(2) list.append(5) list.append(4) 4. 数组与链表 hello‑algo.com 60 # 中间插入元素 list.insert(3, 6) # 在索引 Python 没有内置的栈类,可以把 List 当作栈来使用 stack: List[int] = [] # 元素入栈 stack.append(1) stack.append(3) stack.append(2) stack.append(5) stack.append(4) # 访问栈顶元素 peek: int = stack[-1] # 元素出栈 pop: int = stack.pop() def to_list(self) -> list[int]: """ 转化为列表用于打印""" arr = [] node = self.__peek while node: arr.append(node.val) node = node.next arr.reverse() return arr 基于数组的实现 在基于「数组」实现栈时,我们可以将数组的尾部作为栈顶。在这样的设计下,入栈与出栈操作就分别对应0 码力 | 329 页 | 27.34 MB | 1 年前3
Hello 算法 1.0.0b1 Python版File: list.py === """ 清空列表 """ list.clear() """ 尾部添加元素 """ list.append(1) list.append(3) list.append(2) list.append(5) list.append(4) """ 中间插入元素 """ list.insert(3, 6) # 在索引 3 处插入数字 6 """ 删除元素 """ Python 没有内置的栈类,可以把 List 当作栈来使用 stack = [] """ 元素入栈 """ stack.append(1) stack.append(3) stack.append(2) stack.append(5) stack.append(4) """ 访问栈顶元素 """ peek = stack[-1] """ 元素出栈 """ pop = stack __peek.val def to_list(self): """ 转化为列表用于打印 """ arr = [] node = self.__peek while node: arr.append(node.val) node = node.next arr.reverse() return arr 基于数组的实现 使用「数组」实现栈时,考虑将数组的尾部当作栈顶。这样设计下,「入栈」与「出栈」操作就对应在数组尾部0 码力 | 178 页 | 14.67 MB | 1 年前3
Celery 3.0 Documentationnumbers: res = add.apply_async((2, 2), publisher=publisher) results.append(res) print([res.get() for res in results]) Though this particular example is much better expressed [https://github.com/celery/celery/issues/2722]). Fix contributed by Nicolas Unravel. Task.replace: Append to chain/chord (Closes #3232) Fixed issue #3232 [https://github.com/celery/celery/issues/3232], warning('Task aborted') return value = do_something_expensive(i) results.append(y) logger.info('Task complete') return results In the producer: from __future__ import absolute_import0 码力 | 2110 页 | 2.23 MB | 1 年前3
Celery v4.0.0 Documentationnumbers: res = add.apply_async((2, 2), publisher=publisher) results.append(res) print([res.get() for res in results]) Though this particular example is much better expressed [https://github.com/celery/celery/issues/2722]). Fix contributed by Nicolas Unravel. Task.replace: Append to chain/chord (Closes #3232) Fixed issue #3232 [https://github.com/celery/celery/issues/3232], warning('Task aborted') return value = do_something_expensive(i) results.append(y) logger.info('Task complete') return results In the producer: from __future__ import absolute_import0 码力 | 2106 页 | 2.23 MB | 1 年前3
Hello 算法 1.1.0 Python版使用一个显式的栈来模拟系统调用栈 stack = [] res = 0 # 递:递归调用 for i in range(n, 0, -1): # 通过“入栈操作”模拟“递” stack.append(i) # 归:返回结果 while stack: # 通过“出栈操作”模拟“归” res += stack.pop() # res = 1+2+3+...+n return res 。 # === File: list.py === # 清空列表 nums.clear() # 在尾部添加元素 nums.append(1) nums.append(3) nums.append(2) nums.append(5) nums.append(4) # 在中间插入元素 nums.insert(3, 6) # 在索引 3 处插入数字 6 # 删除元素 nums.pop(3) Python 没有内置的栈类,可以把 list 当作栈来使用 stack: list[int] = [] # 元素入栈 stack.append(1) stack.append(3) stack.append(2) stack.append(5) stack.append(4) # 访问栈顶元素 peek: int = stack[-1] # 元素出栈 pop: int = stack.pop()0 码力 | 364 页 | 18.42 MB | 1 年前3
Hello 算法 1.0.0 Python版使用一个显式的栈来模拟系统调用栈 stack = [] res = 0 # 递:递归调用 for i in range(n, 0, -1): # 通过“入栈操作”模拟“递” stack.append(i) # 归:返回结果 while stack: # 通过“出栈操作”模拟“归” res += stack.pop() # res = 1+2+3+...+n return res 。 # === File: list.py === # 清空列表 nums.clear() # 在尾部添加元素 nums.append(1) nums.append(3) nums.append(2) nums.append(5) nums.append(4) # 在中间插入元素 nums.insert(3, 6) # 在索引 3 处插入数字 6 # 删除元素 nums.pop(3) Python 没有内置的栈类,可以把 list 当作栈来使用 stack: list[int] = [] # 元素入栈 stack.append(1) stack.append(3) stack.append(2) stack.append(5) stack.append(4) # 访问栈顶元素 peek: int = stack[-1] # 元素出栈 pop: int = stack.pop()0 码力 | 362 页 | 17.54 MB | 1 年前3
Hello 算法 1.0.0b5 Python版。 # === File: list.py === # 清空列表 list.clear() # 尾部添加元素 list.append(1) list.append(3) list.append(2) list.append(5) list.append(4) # 中间插入元素 list.insert(3, 6) # 在索引 3 处插入数字 6 # 删除元素 list.pop(3) Python 没有内置的栈类,可以把 List 当作栈来使用 stack: list[int] = [] # 元素入栈 stack.append(1) stack.append(3) stack.append(2) stack.append(5) stack.append(4) # 访问栈顶元素 peek: int = stack[-1] # 元素出栈 pop: int = stack.pop() def to_list(self) -> list[int]: """ 转化为列表用于打印""" arr = [] node = self.__peek while node: arr.append(node.val) node = node.next arr.reverse() return arr 2. 基于数组的实现 使用数组实现栈时,我们可以将数组的尾部作为栈顶。如图 5‑30 码力 | 361 页 | 30.64 MB | 1 年前3
Hello 算法 1.0.0b2 Python版File: list.py === """ 清空列表 """ list.clear() """ 尾部添加元素 """ list.append(1) list.append(3) list.append(2) list.append(5) list.append(4) """ 中间插入元素 """ list.insert(3, 6) # 在索引 3 处插入数字 6 """ 删除元素 """ 没有内置的栈类,可以把 List 当作栈来使用 stack: List[int] = [] """ 元素入栈 """ stack.append(1) stack.append(3) stack.append(2) stack.append(5) stack.append(4) """ 访问栈顶元素 """ peek: int = stack[-1] """ 元素出栈 """ pop: int to_list(self) -> list[int]: """ 转化为列表用于打印 """ arr: list[int] = [] node = self.__peek while node: arr.append(node.val) node = node.next arr.reverse() return arr 基于数组的实现 使用「数组」实现栈时,考虑将数组的尾部当作栈顶。这样设计下,「入栈」与「出栈」操作就对应在数组尾部0 码力 | 186 页 | 15.69 MB | 1 年前3
共 468 条
- 1
- 2
- 3
- 4
- 5
- 6
- 47













