Mark Dickinson <dicki...@gmail.com> added the comment:

This is by design: the choice of -6 is not arbitrary, but follows the standard 
that the Decimal class is based on. Quoting from 
http://speleotrove.com/decimal/daconvs.html#reftostr:

> If the exponent is less than or equal to zero and the adjusted exponent is 
> greater than or equal to -6, [...]

"str" isn't parameterizable (at least, not without a major change to the way 
that Python works), so if you're using it you have to accept the compromises it 
makes. If you want finer control over the string representation of Decimal 
objects, use Python's formatting capabilities:

    >>> from decimal import Decimal
    >>> x = Decimal("1e-8")
    >>> format(x, 'f')
    '0.00000001'

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue43315>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to