This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author serhiy.storchaka
Recipients eric.smith, ezio.melotti, mark.dickinson, martin.panter, rhettinger, scoder, serhiy.storchaka, skrah, tuomas.suutari, wolma
Date 2015-03-29.16:54:25
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1427648066.0.0.368721431567.issue23602@psf.upfronthosting.co.za>
In-reply-to
Content
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)
History
Date User Action Args
2015-03-29 16:54:26serhiy.storchakasetrecipients: + serhiy.storchaka, rhettinger, mark.dickinson, scoder, eric.smith, ezio.melotti, skrah, martin.panter, wolma, tuomas.suutari
2015-03-29 16:54:26serhiy.storchakasetmessageid: <1427648066.0.0.368721431567.issue23602@psf.upfronthosting.co.za>
2015-03-29 16:54:25serhiy.storchakalinkissue23602 messages
2015-03-29 16:54:25serhiy.storchakacreate