Created
March 4, 2010 06:02
-
-
Save danmackinlay/321438 to your computer and use it in GitHub Desktop.
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
| # !/bin/env/python | |
| # or depending how you want to think about it, inverse frequencies. Cahnge these to get different interleaving | |
| A_FREQUENCY = 3 | |
| B_FREQUENCY = 5 | |
| #two nice friendly looking sequences of the form 'a99','a98','a97'... | |
| #(reverse order so we get the correct order with pop()) | |
| a = map( lambda x: 'a'+str(x), range(100,0,-1)) | |
| b = map( lambda x: 'b'+str(x), range(100,0,-1)) | |
| # do an A_FREQUENCY:B_FREQUENCY pulldown (http://en.wikipedia.org/wiki/Telecine#Other_pulldown_patterns ) | |
| for counter in range(1000): | |
| try: | |
| if not counter % A_FREQUENCY: | |
| print a.pop() | |
| if not counter % B_FREQUENCY: | |
| print b.pop() | |
| except IndexError: #one list is empty | |
| break |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment