Most elegant way to generate 3-char sequence

Steve Holden steve at holdenweb.com
Sat Jun 10 08:48:37 EDT 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
> 
> 
You can't justify your solution by requirements gold-plating ... see the 
subject line :-)

regards
  Steve
-- 
Steve Holden       +44 150 684 7255  +1 800 494 3119
Holden Web LLC/Ltd          http://www.holdenweb.com
Love me, love my blog  http://holdenweb.blogspot.com
Recent Ramblings     http://del.icio.us/steve.holden




More information about the Python-list mailing list