Skip to content

Instantly share code, notes, and snippets.

@rik0
Created March 4, 2011 12:32
Show Gist options
  • Save rik0/854552 to your computer and use it in GitHub Desktop.
Save rik0/854552 to your computer and use it in GitHub Desktop.
def generate_row(row_number):
val = 1
r = row_number + 1
yield val
for col in xrange(1, row_number+1):
val = (val * (r - col)) / col
yield val
#@memoize
def create_row(row_number):
return tuple(generate_row(row_number))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment