Serhiy Storchaka <storchaka+cpyt...@gmail.com> added the comment: Many functions implemented in C accept Decimal instances.
>>> chr(decimal.Decimal(65.2)) 'A' This is because PyLong_AsLong() and similar functions call __int__(). Floats are specially prohibited when convert arguments with PyArg_Parse() with the "i" format unit. >>> chr(65.2) Traceback (most recent call last): File "<stdin>", line 1, in <module> TypeError: integer argument expected, got float The specific of factorial() is that it accepts integral floats and raises ValueError instead of TypeError for non-integral floats. Maybe it was planned to extend factorial() to non-integral floats by using a gamma function. All other functions in the math module worked with floats at the time of adding factorial() in issue2138. math.gamma() was added 1.5 years later in issue3366. ---------- nosy: +serhiy.storchaka _______________________________________ Python tracker <rep...@bugs.python.org> <https://bugs.python.org/issue33083> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com