From 70168f1cfcf1ce1b567b5e59ac4dd802cafd6a92 Mon Sep 17 00:00:00 2001 From: "C. Titus Brown" Date: Tue, 9 Mar 2021 07:36:04 -0800 Subject: [PATCH] make 'find' a generator --- src/sourmash/index.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/sourmash/index.py b/src/sourmash/index.py index 085004e048..cf6944e2e9 100644 --- a/src/sourmash/index.py +++ b/src/sourmash/index.py @@ -33,10 +33,9 @@ def find(self, search_fn, *args, **kwargs): matches = [] - for node in self.signatures(): - if search_fn(node, *args): - matches.append(node) - return matches + for ss in self.signatures(): + if search_fn(ss, *args): + yield ss def search(self, query, *args, **kwargs): """Return set of matches with similarity above 'threshold'.