[Python-ideas] %-formatting with Decimals

Eric V. Smith eric at trueblade.com
Wed Mar 12 12:36:50 CET 2014


On 03/12/2014 06:13 AM, Oscar Benjamin wrote:
> On 12 March 2014 00:45, Andrew Barnert <abarnert at yahoo.com> wrote:
>>
>> On Mar 11, 2014, at 15:49, Oscar Benjamin <oscar.j.benjamin at gmail.com> wrote:

>>> There's also no mention of this in the decimal docs.
>>
>> Why should there be? Neither printf-style string formatting nor the float constructor have anything to do with decimals.
> 
> Because it's a relevant issue to consider when working with Decimals.
> In simple cases it will work but in other cases it won't.

In the hopefully unlikely event we do get decimal literals, I think it
would be reasonable to extend %f-formatting (and its friends e and g) to
cover decimals as well as floats.

Eric.



More information about the Python-ideas mailing list