Feature suggestion -- return if true
Dave Angel
davea at ieee.org
Sun Apr 17 22:04:47 EDT 2011
On 01/-10/-28163 02:59 PM, Chris Angelico wrote:
> <snip>
>
> Sure. In my (somewhat contrived) example of factorials, that's going
> to be true (apart from 0! = 0); and if the function returns a string
> or other object rather than an integer, same thing. If there's the
Just to be pedantic, by any reasonable definition, 0! == one, not zero.
One reference: http://en.wikipedia.org/wiki/Factorial
3rd sentence.
More interestingly, There is a gamma function defined for lots of real
and complex numbers, which for all non-negative integers matches the
factorial:
gamma(n) = (n-1)!
The gamma function has the same value (1) for one and two, so to be
consistent, factorial should have that value for both zero and one.
DaveA
More information about the Python-list
mailing list