I had a muuuuuch longer diary entry written, but then I realized it was all shite and needed rewriting. Meanwhile, here's something that I thought was cute:
alphabet = ('A', 'C', 'G', 'T')
def rN(L, *args):
"""
Generate all L-tuples from the given alphabet.
"""
if L == 0:
print args
return
for letter in alphabet:
rN(L-1, letter, *args)
For example, rN(2) gives this:
('A', 'A')
('C', 'A')
('G', 'A')
('T', 'A')
('A', 'C')
('C', 'C')
('G', 'C')
('T', 'C')
('A', 'G')
('C', 'G')
('G', 'G')
('T', 'G')
('A', 'T')
('C', 'T')
('G', 'T')
('T', 'T')
There are just *all sorts* of tricks you can do with Python's function passing semantics, ehh?
Rant of the Day
Why must people post sub-200k binaries via SourceForge's incredibly crufty load-balancing download system?!? It makes them difficult to download, IMO...
--titus
