-
-
Notifications
You must be signed in to change notification settings - Fork 32.1k
bpo-39096: Format specification documentation fixes for numeric types #23575
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
bpo-39096: Format specification documentation fixes for numeric types #23575
Conversation
Doc/library/string.rst
Outdated
@@ -510,10 +510,12 @@ The available presentation types for :class:`float` and | |||
| ``'F'`` | Fixed-point notation. Same as ``'f'``, but converts | | |||
| | ``nan`` to ``NAN`` and ``inf`` to ``INF``. | | |||
+---------+----------------------------------------------------------+ | |||
| ``'g'`` | General format. For a given precision ``p >= 1``, | | |||
| ``'g'`` | General format. For a given precision ``p >= 1``, | |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The change in this line was a bit gratuitous. Happy to revert on demand.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I personally don't care about double spaces between sequences from a readability point of view (but I think some people care, I mean, the double space was added on purpose).
However, this diff will flag the sentence as fuzzy (to review) in all documentation translations, so it'll cost time to ~8 persons. From this point of view, it's better to revert it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, good point. Thanks, @JulienPalard. Now fixed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That looks good to me. Thanks, Mark.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The space appart (sorry for the nitpicking), it looks very good to me!
When you're done making the requested changes, leave the comment: |
I have made the requested changes; please review again. |
Thanks for making the requested changes! @ericvsmith, @JulienPalard: please review the changes made to this pull request. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM.
@JulienPalard: Okay to merge? |
Thanks @mdickinson for the PR, and @JulienPalard for merging it 🌮🎉.. I'm working now to backport this PR to: 3.8, 3.9. |
Sorry @mdickinson and @JulienPalard, I had trouble checking out the |
Thanks @mdickinson ! |
GH-23831 is a backport of this pull request to the 3.8 branch. |
…pythonGH-23575) (cherry picked from commit 886b2e5) Co-authored-by: Mark Dickinson <mdickinson@enthought.com>
Thanks @mdickinson for the PR, and @JulienPalard for merging it 🌮🎉.. I'm working now to backport this PR to: 3.9. |
…pythonGH-23575) (cherry picked from commit 886b2e5) Co-authored-by: Mark Dickinson <mdickinson@enthought.com>
GH-23832 is a backport of this pull request to the 3.9 branch. |
This is a follow-up to #23537. It revises the text for the
g
presentation type and theNone
presentation type forfloat
andDecimal
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 precision0
being the same as precision1
is now closer to the "precision p >= 1" part), and I've attempted to give a more accurate description of the behaviour of theDecimal
type forg
with no given precision. It's still not completely accurate in some details (for example, in the handling of zeros like0E-6
and0E-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 tofloat
, not toDecimal
.https://bugs.python.org/issue39096