Serhiy Storchaka added the comment:

I think that Decimal is not needed for Fraction.__format__ (and I'm not sure 
that issue23602v4.patch is correct). The correct way to format Fraction as 
fixed-precision decimal is to use Fraction.__round__() or similar algorithm. 
The implementation can look like:

    f = self.__round__(prec)
    i = int(f)
    return '%d.%0*d' % (i, prec, abs(f - i) * 10**prec)

----------

_______________________________________
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

Reply via email to