[normalize] Use a generator to filter instead of a list
authorSimon Chabot <simon.chabot@logilab.fr>
Mon, 03 Jun 2019 14:49:36 +0200
changeset 554 c47252b44079
parent 553 9034fe641d86
child 555 575293b56d73
[normalize] Use a generator to filter instead of a list
nazca/utils/normalize.py
--- a/nazca/utils/normalize.py	Thu May 09 17:44:07 2019 +0200
+++ b/nazca/utils/normalize.py	Mon Jun 03 14:49:36 2019 +0200
@@ -140,7 +140,7 @@
     # XXX Unicode, could not use WorkTokenizer.
     # Instead split on whitespaces
     chunks = []
-    for chunk in [t for t in regexp.findall(sentence) if t]:
+    for chunk in (t for t in regexp.findall(sentence) if t):
         # Deals with '
         if "'" in chunk:
             schunks = chunk.split("'")