Most elegant way to generate 3-char sequence

SuperHik junkytownMAKNI at gmail.com
Sat Jun 10 14:12:41 CEST 2006


James Stroud wrote:
> SuperHik wrote:
>> and the winner is... :D
>> David Isaac wrote:
>>
>>> alpha = string.lowercase
>>> x=(a+b+c for a in alpha for b in alpha for c in alpha)
>>
>>
>>
> 
> Not necessarily vying for winner, but David's solution is highly 
> specific as it doesn't do so well for something like
> 
> aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
> aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaab
> .
> .
> .
> zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzy
> zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz

Right. But that wasn't the question :p
> 
> 
> James
> 



More information about the Python-list mailing list