bpo-39096: Format specification documentation fixes for numeric types by mdickinson · Pull Request #23575 · python/cpython (original) (raw)

This is a follow-up to #23537. It revises the text for the g presentation type and the None presentation type for float and Decimal instances.

For the g type, I've moved some pieces of the existing text around in an attempt to improve the flow (for example, the piece about precision 0 being the same as precision 1 is now closer to the "precision p >= 1" part), and I've attempted to give a more accurate description of the behaviour of the Decimal type for g with no given precision. It's still not completely accurate in some details (for example, in the handling of zeros like 0E-6 and 0E-8, the first of which is formatted in fixed-point notation). But I'm not sure that attempting a full, completely accurate, specification in this table is feasible.

For the None type, it should now be clearer that the "at least one digit past the decimal point" part applies only to float, not to Decimal.

https://bugs.python.org/issue39096