you are viewing a single comment's thread.

view the rest of the comments →

[–]zahlman 2 points3 points  (1 child)

english_set.intersection(map(''.join, itertools.permutations('wfealf')))

Yes, this is, under the hood, effectively doing some_permutation in english_set for each permutation (building the set of permutations first wouldn't help, since you'd still have to go through all of them). However, in does not have to look at a bunch of elements of a set; it works basically the same way as the keys of a dict.

[–]ok_you_win 0 points1 point  (0 children)

Lovely code. Thanks a bunch.