dry-python / dry-python/returns

Think about lazy loop method

Open
#647 4 comments 0 reactions 0 assignees View on GitHub
enhancement help wanted
Dominant language
Python
Stars
4.4k
Forks
155
Avg merge
2h 27m
Merged PRs (30d)
22

Description

Imagine that you have a list of 3 elements. And you are going to use `Fold.loop` on it.
The first one is `Failure(1)`.

Currently, `loop` will iterate over all 3 elements. With no breakpoints.
But, `Failure(1)` is a roadblock for any other logic. We should not iterate over other values.

We need to think about best solutions here.
Criteria:

- It should ideally work with any `FailableN`
- It should be similar to `loop` in semantics
- It should be possible to use `loop` or `loop_lazily` on the same functions / helpers. In other words, it should be easy to switch from one to another
- It should be faster than `loop`

Ideas?

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.