Last active
August 29, 2015 14:09
-
-
Save andrewebdev/e3a979cfb46380884f3a to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# The long, slightly incorrect method... | |
def looper(count, depth, *args): | |
""" | |
No this does not allow you to go back in time | |
@param count: number of iterations per loop | |
@param depth: number of loops | |
""" | |
for i in range(count): | |
if depth > 0: | |
args += (i + 1,) | |
looper(count, depth - 1, *args) | |
else: | |
# Do something with all the args passed thus far | |
print args | |
looper(2, 2) | |
# Here follows the _correct_ way to do this, as presented by Tom Dalton on the mailing list | |
import itertools | |
for i in itertools.product(range(10), repeat=10): | |
print i |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment