Loop from 'aaaa' to 'tttt' ?

Peter Hansen peter at engcorp.com
Mon Jun 16 18:56:34 EDT 2003


Christopher Koppler wrote:
> 
> Peter Hansen wrote:
> 
> > >>> set = 'acgt'
> > >>> sets = [''.join(a,b,c,d) for a in set for b in set for c in set for d in set]
> 
> Shouldn't this be
> sets = [''.join((a,b,c,d)) for a in set for b in set for c in set for d in set]
> ?
> join doesn't like more than one argument...

Yes!  Thank you.  I think I started with '%s%s%s%s' % (a,b,c,d) and made the
substitution at the last minute, presumably without testing since it fails
here now without the extra parentheses.  Good catch.

-Peter




More information about the Python-list mailing list