You are chain
ing heterogeneous types together, which is a certain cause of headaches.
Presumably ALC
is a string, so chain
first yields all the characters from the string. When it moves on to product(ALC, repeat=2)
, it starts yielding tuple
s, since that's how product
works.
Just yield homogeneous types from your chain
call (i.e. always yield tuples, join
ing them when you need a string) and the headaches disappear.
for chars in chain(*[product(ALC, repeat=n) for n in range(1,4)]):
...
a.update(''.join(chars).encode('utf-8'))