python - What exactly does '[:]' mean in the example of ipyparallel?
问题描述
Looking at an example of ipyparallel
HERE I see the following code example:
import ipyparallel as ipp
c = ipp.Client()
c[:].apply_sync(lambda : "Hello, World")
What is the meaning of the part c[:]
? What does it mean? What does it do? Why is it used in that way?
解决方案
Indexing or slicing an ipyparallel.Client
instance creates an ipyparallel.DirectView
over the execution engines selected by the index or slice. [:]
selects all engines. The resulting DirectView
can be used to execute code on the selected engines.
This is covered in one of the later sections of the tutorial.
推荐阅读
- python - Python:选择图像的一部分
- c# - 不更新原始列表
- mysql - JPA Select Query 在 SpringBoot 中不起作用
- deep-learning - 谁能解释一下 Feature Pyramid Networks for Object Detection 论文中的“非滑动窗口”声明?
- html - HTML 表单选择:选项属性 selected="selected" 和 default="default" 不起作用
- c++ - C ++:返回基于范围的具有继承对象的for循环迭代器
- python - 如何优化这个创建字典列表的 for 循环?
- c++ - 是否有 UWP 不受支持的 API 列表?
- codenameone - 代号未将构建发送到服务器
- reactjs - create-react-app + typescript 不使用 browserslist