cleaner condition, less force

This commit is contained in:
Felix Van der Jeugt 2016-01-17 21:06:36 +01:00
parent beba5a3d6c
commit cbb6e73b1f

View File

@ -1046,10 +1046,8 @@ class WordHinter:
match = re.search('[A-Za-z]{3,}', candidate) match = re.search('[A-Za-z]{3,}', candidate)
if not match: if not match:
continue continue
length = match.end() - match.start() if 4 < match.end() - match.start() < 8:
if 4 > length or length > 8: yield candidate[match.start():match.end()].lower()
continue
yield candidate[match.start():match.end()].lower()
def any_prefix(self, hint, existing): def any_prefix(self, hint, existing):
return any(hint.startswith(e) or e.startswith(hint) return any(hint.startswith(e) or e.startswith(hint)