[SciPy-dev] Definition of gammaln(x) for negative x

G-J van Rooyen gvrooyen@gmail....
Mon Nov 3 11:53:33 CST 2008


>> Creating a second, differently-named function (e.g. gammaln2) that
>> returns magnitude and sign information is probably just as bad as
>> having varying return types.
>>
>> So which of the above is the lesser evil? Or is there an elegant solution?
>
> The latter. By far. I'm not sure why you think it would be just as bad
> as having varying return types.

It just seems to me that

   Y = gammaln(X)
and
   (Y, sign) = gammaln(X,'sign')

are conceptually identical to

   Y = gammaln(X)
and
   (Y,sign) = gammaln_sign(X)

The latter just absorbs the mode argument into the alternative
function name. But since they're equivalent to me, and you have a
clear preference for the latter, I'll go with the second option :)

Thanks for the feedback

Gert-Jan


More information about the Scipy-dev mailing list