Message63816
FWIW, I don't agree with the reasoning on the rejection. Hundreds of
calculator layouts and school textbooks suggest that you can have a
useful factorial function without having to also add binomials and
whatnot.
The OP requested a simple, widely understood integer method with no
arguments. That seems very reasonable to me. A function or method is
not clutter if it has widespread uses and a near zero learning curve.
This is a re-invented function and it would be ashamed to not offer it
because it is a pita every time you need it and it's not already there.
My guess is that half of long-term Python programmers have written
their own variant at some point but only a small percentage of those
went on to write a binomial coeffient function.
Eventhough this is re-invented often, it is not often re-invented well
(i.e. good error messages for non-integer or negative inputs, a fast
implementation with pre-computed values for small inputs, and being
attached to a namespace where you can find it when needed).
To compare, I checked the somewhat clean SmallTalk Integer API and found
it had factorial, gcd, and lcm, but not the other functions mentioned
in the thread. See:
http://www.csci.csusb.edu/dick/samples/smalltalk.methods.html#Integer%20methods
Re-opening for further discussion. If someone still feels that it is a
bad idea, then go ahead and re-close; otherwise, I think we ought to
accept this guy's request. |
|
Date |
User |
Action |
Args |
2008-03-18 00:27:22 | rhettinger | set | spambayes_score: 0.166898 -> 0.166898 recipients:
+ rhettinger, phr, mark.dickinson, dtorp, alanmcintyre, ajaksu2, avalind, ilan |
2008-03-18 00:27:22 | rhettinger | set | spambayes_score: 0.166898 -> 0.166898 messageid: <1205800042.36.0.488909235458.issue2138@psf.upfronthosting.co.za> |
2008-03-18 00:27:21 | rhettinger | link | issue2138 messages |
2008-03-18 00:27:20 | rhettinger | create | |
|