Issue37315
Created on 2019-06-17 08:49 by serhiy.storchaka, last changed 2019-06-17 14:02 by serhiy.storchaka. This issue is now closed.
| Pull Requests | |||
|---|---|---|---|
| URL | Status | Linked | Edit |
| PR 14147 | merged | serhiy.storchaka, 2019-06-17 09:01 | |
| Messages (3) | |||
|---|---|---|---|
| msg345828 - (view) | Author: Serhiy Storchaka (serhiy.storchaka) * | Date: 2019-06-17 08:49 | |
Currently math.factorial() accepts integer-like objects (including objects with defined __index__) as well as float instances with integral value (but not arbitrary float-like objects with defined __float__). I suppose this was happen because factorial() was the first integer functions in the math module, and all other functions accepted floats at that time. See also issue7550. But now we have more pure integer functions in the math module: gcd, isqrt, comb, perm. Seems accepting floats in factorial was a mistake. Now we can fix it, and deprecate using factorial() with floats. Initial version of factorial() accepted also non-integral numbers (except float) with defined __int__. It was fixed in issue33083. |
|||
| msg345842 - (view) | Author: Mark Dickinson (mark.dickinson) * | Date: 2019-06-17 10:48 | |
+1 from me; let's make `factorial` consistent with the other integer-based math module functions. |
|||
| msg345859 - (view) | Author: Serhiy Storchaka (serhiy.storchaka) * | Date: 2019-06-17 13:57 | |
New changeset 231aad38493c871dd32930a21d256cbacd2ae20c by Serhiy Storchaka in branch 'master': bpo-37315: Deprecate accepting floats in math.factorial(). (GH-14147) https://github.com/python/cpython/commit/231aad38493c871dd32930a21d256cbacd2ae20c |
|||
| History | |||
|---|---|---|---|
| Date | User | Action | Args |
| 2019-06-17 14:02:26 | serhiy.storchaka | set | status: open -> closed resolution: fixed stage: patch review -> resolved |
| 2019-06-17 13:57:58 | serhiy.storchaka | set | messages: + msg345859 |
| 2019-06-17 10:48:32 | mark.dickinson | set | messages: + msg345842 |
| 2019-06-17 09:01:16 | serhiy.storchaka | set | keywords:
+ patch stage: patch review pull_requests: + pull_request13988 |
| 2019-06-17 08:49:55 | serhiy.storchaka | create | |