> Ah, this definitely seems to work! It's a lot nicer in appearance than > my previous code, that's for sure. It actually runs in approximately > the same amount of time though.
As a side note, this problem will always be "slow". The number of combinations grows exponentially with n. No matter how fast you generate a combination, generating them all it's going to take a lot of time if n is slighty bigger. -- http://mail.python.org/mailman/listinfo/python-list