Incompatible (wrt floats) processing of alignment and '0' flag in Fraction's formatting #130716
Labels
docs
Documentation in the Doc dir
interpreter-core
(Objects, Python, Grammar, and Parser dirs)
type-bug
An unexpected behavior, bug, or error
Bug report
Bug description:
While not being documented, this behavior is intentional (see #100161): "The Fraction formatter is also stricter about combining these two things: it's not permitted to use both the '0' flag and explicit alignment, on the basis that we should refuse the temptation to guess in the face of ambiguity." In floats case, "0" flag is just ignored if the fill character (and, thus, alignment) already specified.
Maybe it's not a bad idea to use Fraction's behavior for floats too, i.e. deprecate this silent resolution of ambiguity. Or just document this discrepancy.
Decimal's behave here like Fraction's:
CPython versions tested on:
CPython main branch
Operating systems tested on:
No response
The text was updated successfully, but these errors were encountered: