[issue39077] Numeric formatting inconsistent between int, float and Decimal
Mark Dickinson
report at bugs.python.org
Tue Dec 17 16:54:56 EST 2019
Mark Dickinson <dickinsm at gmail.com> added the comment:
[Eric]
> Is that the "0" here: [...]
Yes, sorry; that could have been clearer.
> In particular, what if you specify a different alignment type with the pre-width 0?
Right, that's the critical question here. For floats and ints, an explicitly-specified alignment type overrides the implicit "=". But Decimal raises. The Decimal behaviour seems more reasonable, but the float and int behaviours are more historically baked-in, and riskier to change.
And then there's a parallel question with the fill character: should an explicitly-given fill override the "0"-fill character that's implicit in that "[0]"? int and float say "yes". Decimal says "ValueError".
----------
_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue39077>
_______________________________________
More information about the Python-bugs-list
mailing list