Tuomas Suutari added the comment: Thanks for the comments again!
I fixed the "format(F(4, 27), '.1f') -> 0.2" issue Serhiy Storchaka reported. Fix for that was as simple as adding one to the precision the decimals are calculated in, but while adding test cases for that I realized two new things: (a) I don't want "f" specifier to mean "infinite" precision, but instead some predefined value. I chose 6. (b) How about rounding? I don't want the current decimal context to affect that, since it's not logical that formatting of Fractions depends on the decimal context. The rounding thing made things harder, since there was no way to pass decimal context for Decimal.__format__ without changing the local context -- at least with the C implementation; the Python implementation (_pydecimal) provided nicer API with optional context keyword argument. So I decided to unify the C and Py API's of Decimal.__format__ and add the keyword argument support to the C API too. This is done in this v4 of the patch. There's no docs for the added Decimal.__format__ kwargs, since I want some comments on that change first. ---------- Added file: http://bugs.python.org/file38728/issue23602v4.patch _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue23602> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com