Skip to content

Instantly share code, notes, and snippets.

@sanketsudake
Created October 20, 2012 08:30
Show Gist options
  • Save sanketsudake/3922683 to your computer and use it in GitHub Desktop.
Save sanketsudake/3922683 to your computer and use it in GitHub Desktop.
Iterating Cycle in Python
import itertools
'''
Here some functios a, b, c, d
which if we can run recursively
using itertools
'''
def a():
print "hello"
def b():
print "good morning"
def c():
print "good night"
def d():
print "bye"
def runcycle(*args, **kw):
for func in itertools.cycle([a, b, c, d]):
func()
if __name__ == '__main__':
runcycle()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment