New submission from Szymon <szymon1...@gmail.com>:

str(Decimal("0.00000001")) always returns "1E-8" and there is no way to 
directly get the "0.00000001" string back without writting custom method for 
converting DecimalTuple to string. This is caused by arbitrary choice of `and 
leftdigits > -6` condition in 
https://github.com/python/cpython/blob/master/Lib/_pydecimal.py#L1052 .
The hardcoded value of -6 should be parametrizable. This can be done by adding 
it as argument to the __str__ method or maybe by adding it to the decimal 
context.

----------
messages: 387618
nosy: sim1234
priority: normal
severity: normal
status: open
title: Decimal.__str__ has no way to force exact decimal representation
type: enhancement
versions: Python 3.10, Python 3.6, Python 3.7, Python 3.8, Python 3.9

_______________________________________
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