iterator? way of generating all possible combinations?

akameswaran at akameswaran at
Tue May 30 21:20:23 CEST 2006

Scott David Daniels wrote:

> This works with "iterables" (and produces), rather than "iterators",
> which is vital to the operation.
> --Scott David Daniels
> scott.daniels at

Sorry, it doesn't.  It works with strings.  It doesn't work with file,
it doesn't work with iterators I have created.

I have been using file objects as my test iterables for now - forgoing
any complications in my own iterables.  such that my test bed has been:

f = open('word.txt')
f2 = open('word2.txt')
f3 = open('word3.txt')

for combo in [testable function here]
    print combo

Each file contains the letter a through g on, with each letter on a
line.  At least I don't feel as bad anymore.  My first attempts
generate the same output, and a couple of my earlier attempts work
quite nicely with lists, and similar things.  But I can't find anthing
that works generically with any iterable, nor anything that works with

More information about the Python-list mailing list