[Python-ideas] Introduce `start=1` argument to `math.factorial`

Steven D'Aprano steve at pearwood.info
Thu Sep 18 06:13:50 CEST 2014


On Wed, Sep 17, 2014 at 04:02:44PM -0700, Ram Rachum wrote:
> I suggest introducing a `start=1` argument to `math.factorial`, so the 
> result would be (the C-optimized version of) `product(range(start, x+1), 
> start=1)`. This'll be useful for combinatorical calculations.

Then it wouldn't be the factorial function any more.

There are lots of functions which could be useful for combinatorical 
calculations, including !n and n!!, do you think this particular one 
would be of broad enough interest that it deserves to be in the standard 
library?

Do you know of any other programming languages which offer this "partial 
factorial" function in their standard library?


-- 
Steven


More information about the Python-ideas mailing list