How to generate k+1 length strings from a list of k length strings?

bearophileHUGS at lycos.com bearophileHUGS at lycos.com
Thu Jun 8 12:48:51 EDT 2006


Boris Borcic:
> I'd favor the following, that I find most readable
> sets = map(set,list_of_strings)
> res = set(''.join(sorted(s1|s2)) for s1 in sets for s2 in sets if len(s1^s2)==2)

I think there can be written more readable code. For my programs I
usually prefer simpler code, that (if possible) even a children can
understand. So I can debug, modify and improve it better & faster.

Bye,
bearophile




More information about the Python-list mailing list