3 ms·
In a traditional for loop fashion: def known_edits2(word): L = [] for e1 in edits1(word): for e2 in edits1(e1): if e2 in NWORDS:
by marcinw 16y ago
In a traditional for loop fashion:
def known_edits2(word):
L = []
for e1 in edits1(word):
for e2 in edits1(e1):
if e2 in NWORDS:
L.append(e2)
return set(L)
- tgflynn 16y agoThanks for the clarification. I didn't realize that list comprehensions mapped so directly to nested loops, I was particularly confused by the variable name scoping rules.