Created
October 20, 2012 08:30
-
-
Save sanketsudake/3922683 to your computer and use it in GitHub Desktop.
Iterating Cycle in Python
This file contains hidden or 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
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