Message 182451 - Python tracker (original) (raw)
Christian Heimes <report@bugs.python.org> wrote:
The output is from Python 3.3. Why has Python 3.3 a less informative error message than 3.2?
Because the error is discovered in libmpdec and it would require a significant amount of work to provide fine-grained error messages.
I also wonder why it works with floats if it has a special meaning? Either float or Decimal is broken.
Yes, IMO float should detect the ambiguity. You see that the zero implies left padding:
"{:06}".format(1.2) '0001.2'
And in case of a conflict right padding wins:
"{:<06}".format(1.2) '1.2000'
The unambiguous way to get right padding is:
"{:0<6}".format(Decimal("1.2")) '1.2000'
"{:X<6}".format(Decimal("1.2")) '1.2XXX'