Skip to content

Instantly share code, notes, and snippets.

@danmackinlay
Created March 4, 2010 06:02
Show Gist options
  • Select an option

  • Save danmackinlay/321438 to your computer and use it in GitHub Desktop.

Select an option

Save danmackinlay/321438 to your computer and use it in GitHub Desktop.
# !/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