[issue33083] math.factorial accepts non-integral Decimal instances
Mark Dickinson
report at bugs.python.org
Sun Jul 29 05:40:40 EDT 2018
Mark Dickinson <dickinsm at gmail.com> added the comment:
[Tal Einat]
> So we keep things consistent by supporting Decimal and Fraction inputs, but raising ValueError if the value isn't a non-negative integer?
Re-reading the issue comments, my preference is still the same as expressed in msg313936:
- no behaviour change if the input is a float
- if the input is not a float, require it to be integer-like (in the sense of implementing __index__), and complain with a TypeError if it isn't
- defer discussion of deprecating acceptance of integer-valued floats to another issue
So `math.factorial(x)` would become a `TypeError` for a `Decimal` or `Fraction` instance, whether integral or not.
----------
_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue33083>
_______________________________________
More information about the Python-bugs-list
mailing list