We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent e06b34c commit 5ce6da5Copy full SHA for 5ce6da5
adaptive/learner/sequence_learner.py
@@ -81,7 +81,9 @@ class SequenceLearner(BaseLearner):
81
def __init__(self, function, sequence):
82
self._original_function = function
83
self.function = _IgnoreFirstArgument(function)
84
- self._to_do_indices = SortedSet({i for i, _ in enumerate(sequence)})
+ # prefer range(len(...)) over enumerate to avoid slowdowns
85
+ # when passing lazy sequences
86
+ self._to_do_indices = SortedSet(range(len(sequence)))
87
self._ntotal = len(sequence)
88
self.sequence = copy(sequence)
89
self.data = SortedDict()
0 commit comments