Created
October 17, 2013 00:34
-
-
Save fsiler/7017400 to your computer and use it in GitHub Desktop.
This file contains 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
#!/usr/bin/env python | |
from __future__ import division, generators, nested_scopes, print_function, with_statement | |
import os, readline, rlcompleter, atexit | |
readline.parse_and_bind("tab: complete") | |
readline.set_history_length(10000) | |
histfile = os.path.expanduser("~/.python/history") | |
try: | |
readline.read_history_file(histfile) | |
except IOError: | |
pass | |
def binomial(n,k): | |
"""return binominal coefficients for (n,k)""" | |
return int(reduce(lambda a,b: a*(n-b)/(b+1),xrange(k),1)) | |
atexit.register(readline.write_history_file, histfile) | |
del histfile, os |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment