Closed frostming closed 2 years ago
I intentionally separated the two wrapper implementations to help debugging. _SequenceIterableView
holds the original sequence, which can be random-accessed and iterated over multiple times, which is useful in the debugger to better identify the situation.
@uranusjr Fine, I revert the change to keep the SequenceIterableView
, while FactoryIterableView
is still optimized to avoid multiple calls to factory
, especially when retrieving the first value is expensive.
@uranusjr Can you revisit this PR? I think it is worth merging since it will save a lot if it is expensive to construct the first candidate.
Result iterable returned by
find_matches()
won't be consumed all at once. Also unite the_FactoryIterableView
with_SequenceIterableView
With the change, the underlying iterable is guaranteed to be consumed only once.