[issue23602] Implement __format__ for Fraction

Tuomas Suutari report at bugs.python.org
Sun Mar 8 23:33:34 CET 2015


Tuomas Suutari added the comment:

Here's the next round of the patch.

For formatting fractions with any given precision I had to parse the precision from format specifier and at this point it seemed easier to just create a general parser for the Format Specification Mini-Language.  In this patch it is implemented in fractions._parse_format_specifier function, but maybe this kind of general function should be moved to better place and be documented and exported. What do you think?

----------
Added file: http://bugs.python.org/file38394/issue23602v2.patch

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue23602>
_______________________________________


More information about the Python-bugs-list mailing list