◐ Shell
reader mode source ↗
Skip to content

gh-100428: Make int documentation more accurate#100436

Merged
hauntsaninja merged 5 commits into
python:mainfrom
hauntsaninja:gh-100428-int
Jan 2, 2023
Merged

gh-100428: Make int documentation more accurate#100436
hauntsaninja merged 5 commits into
python:mainfrom
hauntsaninja:gh-100428-int

Conversation

@hauntsaninja

@hauntsaninja hauntsaninja commented Dec 22, 2022

Copy link
Copy Markdown
Contributor
  • Remove first link to lexical definition of integer literal, since it doesn't apply (differs in handling of leading zeros, base needs to be explicitly specified, unicode digits are allowed)
  • Better describe handling of leading zeros and unicode digits
  • Base 0 does not work "exactly" as like a code literal, since it allows unicode digits. Link code literal to lexical definition of integer literal.

- Remove first link to lexical definition of integer literal, since it
  doesn't apply (differs in handling of leading zeros, base needs to be
  explicitly specified, unicode digits are allowed)
- Better describe handling of leading zeros and unicode digits
- Base 0 does not work exactly as like a code literal, since it allows
  Unicode digits. Link code literal to lexical definition of integer
  literal.

@mdickinson mdickinson left a comment

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.

Hide comment

Thanks for this PR! Looks good so far, but I think we might need a second pass before it's ready to go in. I've left some comments - discussion welcome!

@hauntsaninja

hauntsaninja commented Jan 1, 2023

Copy link
Copy Markdown
Contributor Author

Thanks for the feedback! Good catch on the underscores. I've made changes to address all your points, except that I haven't added a grammar production. I'm a little hesitant to add one, because I think describing the differences between bases might cause it to be a little long winded in a not especially helpful fashion. If the latest update still feels misleading or is missing detail, I can add one :-)

@mdickinson mdickinson left a comment

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.

Hide comment

LGTM, modulo fixing a missing word in one of the sentences (see comment below).

Thank you!

@mdickinson

Copy link
Copy Markdown
Member

except that I haven't added a grammar production [...]

Sure, either way seems fine. For me, if I were writing this I'd use a grammar production primarily out of laziness - if I'm describing what's happening in English text, I have to examine that text every which way for possible ambiguities, sources of potential reader misunderstanding and imprecisions; with a grammar production, it takes less work to be confident that it expresses the legal syntax clearly and unambiguously.

@hauntsaninja hauntsaninja merged commit edfbf56 into python:main Jan 2, 2023
@miss-islington

Copy link
Copy Markdown
Contributor

Thanks @hauntsaninja for the PR 🌮🎉.. I'm working now to backport this PR to: 3.10, 3.11.
🐍🍒⛏🤖

@hauntsaninja hauntsaninja deleted the gh-100428-int branch January 2, 2023 03:14
@bedevere-bot

Copy link
Copy Markdown

GH-100674 is a backport of this pull request to the 3.11 branch.

@bedevere-bot bedevere-bot removed the needs backport to 3.11 only security fixes label Jan 2, 2023
miss-islington pushed a commit to miss-islington/cpython that referenced this pull request Jan 2, 2023
- Remove first link to lexical definition of integer literal, since it
  doesn't apply (differs in handling of leading zeros, base needs to be
  explicitly specified, unicode digits are allowed)
- Better describe handling of leading zeros, unicode digits, underscores
- Base 0 does not work exactly as like a code literal, since it allows
  Unicode digits. Link code literal to lexical definition of integer
  literal.
(cherry picked from commit edfbf56)

Co-authored-by: Shantanu <12621235+hauntsaninja@users.noreply.github.com>
@bedevere-bot

Copy link
Copy Markdown

GH-100675 is a backport of this pull request to the 3.10 branch.

@bedevere-bot bedevere-bot removed the needs backport to 3.10 only security fixes label Jan 2, 2023
miss-islington pushed a commit to miss-islington/cpython that referenced this pull request Jan 2, 2023
- Remove first link to lexical definition of integer literal, since it
  doesn't apply (differs in handling of leading zeros, base needs to be
  explicitly specified, unicode digits are allowed)
- Better describe handling of leading zeros, unicode digits, underscores
- Base 0 does not work exactly as like a code literal, since it allows
  Unicode digits. Link code literal to lexical definition of integer
  literal.
(cherry picked from commit edfbf56)

Co-authored-by: Shantanu <12621235+hauntsaninja@users.noreply.github.com>
miss-islington added a commit that referenced this pull request Jan 2, 2023
- Remove first link to lexical definition of integer literal, since it
  doesn't apply (differs in handling of leading zeros, base needs to be
  explicitly specified, unicode digits are allowed)
- Better describe handling of leading zeros, unicode digits, underscores
- Base 0 does not work exactly as like a code literal, since it allows
  Unicode digits. Link code literal to lexical definition of integer
  literal.
(cherry picked from commit edfbf56)

Co-authored-by: Shantanu <12621235+hauntsaninja@users.noreply.github.com>
miss-islington added a commit that referenced this pull request Jan 2, 2023
- Remove first link to lexical definition of integer literal, since it
  doesn't apply (differs in handling of leading zeros, base needs to be
  explicitly specified, unicode digits are allowed)
- Better describe handling of leading zeros, unicode digits, underscores
- Base 0 does not work exactly as like a code literal, since it allows
  Unicode digits. Link code literal to lexical definition of integer
  literal.
(cherry picked from commit edfbf56)

Co-authored-by: Shantanu <12621235+hauntsaninja@users.noreply.github.com>
hauntsaninja added a commit to hauntsaninja/cpython that referenced this pull request Apr 30, 2023
Following discussion in https://discuss.python.org/t/bug-in-int-42/26360/5

This tests some of the things documented in python#100436
hauntsaninja added a commit that referenced this pull request May 1, 2023
Following discussion in https://discuss.python.org/t/bug-in-int-42/26360/5

This tests some of the things documented in #100436

Co-authored-by: Gregory P. Smith <greg@krypto.org>
miss-islington pushed a commit to miss-islington/cpython that referenced this pull request May 1, 2023
Following discussion in https://discuss.python.org/t/bug-in-int-42/26360/5

This tests some of the things documented in python#100436

(cherry picked from commit 69bc86c)

Co-authored-by: Shantanu <12621235+hauntsaninja@users.noreply.github.com>
Co-authored-by: Gregory P. Smith <greg@krypto.org>
hauntsaninja added a commit that referenced this pull request May 1, 2023
Improve int test coverage (GH-104024)

Following discussion in https://discuss.python.org/t/bug-in-int-42/26360/5

This tests some of the things documented in #100436

(cherry picked from commit 69bc86c)

Co-authored-by: Shantanu <12621235+hauntsaninja@users.noreply.github.com>
Co-authored-by: Gregory P. Smith <greg@krypto.org>
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.

4 participants