[New-bugs-announce] [issue37315] Deprecate using math.factorial() with floats

Serhiy Storchaka report at bugs.python.org
Mon Jun 17 04:49:55 EDT 2019


New submission from Serhiy Storchaka <storchaka+cpython at gmail.com>:

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.

----------
components: Extension Modules
messages: 345828
nosy: mark.dickinson, pablogsal, rhettinger, serhiy.storchaka, stutzbach
priority: normal
severity: normal
status: open
title: Deprecate using math.factorial() with floats
type: enhancement
versions: Python 3.9

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue37315>
_______________________________________


More information about the New-bugs-announce mailing list