For starters, I read this: all permutations of a binary sequence x bits long
This is similar to what I want, but I don't want to generate all permutations in advance. What I want is more of a generator that I can step through and stop whenever I want (for efficiency reasons, I have cutoff conditions where I want to halt).
I was wondering if there is an elegant way to do this Python. The answers to the question above all involved ".join"s, but I don't think that will work here. I assume I need to use itertools.
Any ideas?