> for w in text.split(): > n = len(w) > # Make sure this range matches in tokenize_word(). > if 3 <= n <= maxword: > yield w > > elif n >= 3: > for t in tokenize_word(w): > yield t Maybe to make the intent clearer, the elif test should be elif n > maxword: Skip