alexjbuck / alexjbuck/pathvein
Convert `scan` and `shuffle` to generator objects
- 主要语言
- Python
- 星标
- 3
- 派生
- 0
- PR 合并指标
- 30 天内没有已合并 PR
描述
Instead of constructing a set of `ScanResult` and a set of `ShuffleResults`, these functions should be generators that yield control back to the caller after each loop iteration.
If the functions become `Generator` types, then it a call site that used to be:
```python
result = scan(**inputs)
```
can trivially become
```python
result = set(scan(**inputs))
```
However with a generator we can handle arbitrarily large input/scan spaces without necessarily being concerned about holding the full results in memory.
Also a generator yields flow control back to the caller allowing for greater flexibility with logging, inspection, and possibly breaking the loop based on some condition:
```python
for result in scan(**inputs):
do_something_with(result)
```
now becomes possible in a way that it was not when the loop was fully encapsulated within the `scan` or `shuffle` functions.
贡献指南
这个仓库没有索引到贡献指南
评估
这个 Issue 还没有评估数据。