Michael Amrhein <[email protected]> added the comment:
Mark, to answer your question regarding the two implementations of Decimals:
No, in the cases I stated above there are no differences in their behaviour.
In order to dig a bit deeper, I wrote a little test:
d = cdec.Decimal("1234567890.1234")
p = pydec.Decimal("1234567890.1234")
for fill in ('', ' ', '_'):
for align in ('', '<', '>', '^', '='):
for sign in ('', '-', '+', ' '):
for zeropad in ('', '0'):
for min_width in ('', '25'):
for thousands_sep in ('', ','):
for precision in ('', '.3', '.5'):
for ftype in ('', 'e', 'f', 'g'):
fmt =
f"{fill}{align}{sign}{zeropad}{min_width}{thousands_sep}{precision}{ftype}"
try:
df = format(d, fmt)
except ValueError:
df = "<ValueError>"
try:
pf = format(p, fmt)
except ValueError:
pf = "<ValueError>"
if df != pf:
print(fmt, df, pf)
It did not reveal any differences. The two implementations are equivalent
regarding the tested combinations.
----------
_______________________________________
Python tracker <[email protected]>
<https://bugs.python.org/issue39077>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com