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

Clint Hepner clint.hepner at gmail.com
Thu Sep 18 05:04:29 CEST 2014


-1 on overloading math.factorial to compute something that isn't a
factorial, but a falling factorial. Such a new function would be easy to
add, though, if deemed useful.

     math.falling_factorial(x, n) = product(range(x - n + 1, x + 1))

and the similar function

    math.rising_factorial(x, n) = product(range(x, x+n))

On Wed, Sep 17, 2014 at 7:02 PM, Ram Rachum <ram.rachum at gmail.com> 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.
>
>
>
>
> _______________________________________________
> Python-ideas mailing list
> Python-ideas at python.org
> https://mail.python.org/mailman/listinfo/python-ideas
> Code of Conduct: http://python.org/psf/codeofconduct/
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20140917/0a003bb9/attachment.html>


More information about the Python-ideas mailing list