[Edu-sig] another Python generator (Bernoulli numbers)

2013-04-16 Thread kirby urner
from fractions import Fraction as R def choose(n, k): chosen / adapted from: http://www.velocityreviews.com/forums/t502438-combination-function-in-python.html ntok = 1 for t in range(min(k, n-k)): ntok = ntok*(n-t)//(t+1) return ntok def Bernoulli():

[Edu-sig] explaining about decorators

2013-04-16 Thread Kirby Urner
I'm sure this could be improved upon and/or is discussed more eloquently elsewhere. I'm inviting links, comments. I recall our own discussion here on edu-sig where we played with @D def f(x):... as taking a Derivative of f. Guido didn't think it was such a great idea as I recall.