Skip to content

bpo-39096: Format specification documentation fixes for numeric types#23575

Merged
JulienPalard merged 4 commits into
python:masterfrom
mdickinson:fix/none-presentation-type
Dec 18, 2020
Merged

bpo-39096: Format specification documentation fixes for numeric types#23575
JulienPalard merged 4 commits into
python:masterfrom
mdickinson:fix/none-presentation-type

Conversation

@mdickinson
Copy link
Copy Markdown
Member

@mdickinson mdickinson commented Nov 30, 2020

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

Comment thread Doc/library/string.rst Outdated
| | ``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``, |
Copy link
Copy Markdown
Member Author

@mdickinson mdickinson Nov 30, 2020

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.

Copy link
Copy Markdown
Member

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.

Copy link
Copy Markdown
Member Author

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.

Comment thread Doc/library/string.rst Outdated
Copy link
Copy Markdown
Member

@ericvsmith ericvsmith left a 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.

Copy link
Copy Markdown
Member

@JulienPalard JulienPalard left a 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!

@bedevere-bot
Copy link
Copy Markdown

When you're done making the requested changes, leave the comment: I have made the requested changes; please review again.

Comment thread Doc/library/string.rst Outdated
@mdickinson
Copy link
Copy Markdown
Member Author

I have made the requested changes; please review again.

@bedevere-bot
Copy link
Copy Markdown

Thanks for making the requested changes!

@ericvsmith, @JulienPalard: please review the changes made to this pull request.

Copy link
Copy Markdown
Member

@ericvsmith ericvsmith left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM.

@mdickinson
Copy link
Copy Markdown
Member Author

@JulienPalard: Okay to merge?

@JulienPalard JulienPalard merged commit 886b2e5 into python:master Dec 18, 2020
@miss-islington
Copy link
Copy Markdown
Contributor

Thanks @mdickinson for the PR, and @JulienPalard for merging it 🌮🎉.. I'm working now to backport this PR to: 3.8, 3.9.
🐍🍒⛏🤖 I'm not a witch! I'm not a witch!

@miss-islington
Copy link
Copy Markdown
Contributor

Sorry @mdickinson and @JulienPalard, I had trouble checking out the 3.9 backport branch.
Please backport using cherry_picker on command line.
cherry_picker 886b2e5c7a2caf87070728dba8f18c3d65e51071 3.9

@JulienPalard
Copy link
Copy Markdown
Member

Thanks @mdickinson !

@bedevere-bot
Copy link
Copy Markdown

GH-23831 is a backport of this pull request to the 3.8 branch.

miss-islington pushed a commit to miss-islington/cpython that referenced this pull request Dec 18, 2020
…pythonGH-23575)

(cherry picked from commit 886b2e5)

Co-authored-by: Mark Dickinson <mdickinson@enthought.com>
@miss-islington
Copy link
Copy Markdown
Contributor

Thanks @mdickinson for the PR, and @JulienPalard for merging it 🌮🎉.. I'm working now to backport this PR to: 3.9.
🐍🍒⛏🤖

miss-islington pushed a commit to miss-islington/cpython that referenced this pull request Dec 18, 2020
…pythonGH-23575)

(cherry picked from commit 886b2e5)

Co-authored-by: Mark Dickinson <mdickinson@enthought.com>
@bedevere-bot
Copy link
Copy Markdown

GH-23832 is a backport of this pull request to the 3.9 branch.

miss-islington added a commit that referenced this pull request Dec 18, 2020
…GH-23575)

(cherry picked from commit 886b2e5)

Co-authored-by: Mark Dickinson <mdickinson@enthought.com>
miss-islington added a commit that referenced this pull request Dec 18, 2020
…GH-23575)

(cherry picked from commit 886b2e5)

Co-authored-by: Mark Dickinson <mdickinson@enthought.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

docs Documentation in the Doc dir skip news

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants