8000 bpo-39096: Format specification documentation fixes for numeric types by mdickinson · Pull Request #23575 · python/cpython · GitHub
[go: up one dir, main page]

Skip to content

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

Merged
merged 4 commits into from
Dec 18, 2020

Conversation

mdickinson
Copy link
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

@@ -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``, |
Copy link
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
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
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.

Copy link
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
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

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

@mdickinson
Copy link
Member Author

I have made the requested changes; please review again.

@bedevere-bot
Copy link

Thanks for making the requested changes!

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

Copy link
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
Member Author

@JulienPalard: Okay to merge?

@JulienPalard JulienPalard merged commit 886b2e5 into python:master Dec 18, 2020
@miss-islington
Copy link
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
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
Member

Thanks @mdickinson !

@bedevere-bot
Copy link

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>
@JulienPalard JulienPalard added needs backport to 3.9 only security fixes and removed needs backport to 3.9 only security fixes labels Dec 18, 2020
@miss-islington
Copy link
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

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

@bedevere-bot bedevere-bot removed the needs backport to 3.9 only security fixes label Dec 18, 2020
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
0