Skip to content

Commit

Permalink
add a comment about using a generator expression
Browse files Browse the repository at this point in the history
  • Loading branch information
basnijholt committed Apr 24, 2020
1 parent 5ba052c commit c7a12a4
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions adaptive/runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,7 @@ def do_log(self):

def _ask(self, n):
pending_ids = self._pending_tasks.values()
# using generator here because we only need until `n`
pids_gen = (pid for pid in self._to_retry.keys() if pid not in pending_ids)
pids = list(itertools.islice(pids_gen, n))

Expand Down

0 comments on commit c7a12a4

Please sign in to comment.