There was a problem hiding this 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!
Sorry, something went wrong.
| 8, 10, or 16, and so that ``int('010', 0)`` is not legal, while | ||
| ``int('010')`` is, as well as ``int('010', 8)``. | ||
| :class:`bytes`, or :class:`bytearray` instance representing an integer | ||
| literal in radix *base*. Optionally, the literal can be |
There was a problem hiding this comment.
Now that we're no longer linking to the Python grammar, I think we could drop the use of literal, which is somewhat misleading. For the first use, [ ...] representing an integer in radix *base* [...] seems clear enough. But other uses might require some more reworking below, though. Rather than expressing in words, it may be clearest to re-introduce a formal grammar production, analogous to what's now in the float description. (Maybe with "digit" as a terminal, where valid digits are then expressed in text.)
Without the link to the grammar, we're also missing information about the rules for underscores. (I'm not suggesting putting that link back in, but rather, finding a way to include the information about underscores in this text.)
Sorry, something went wrong.
|
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 :-) |
Sorry, something went wrong.
There was a problem hiding this comment.
LGTM, modulo fixing a missing word in one of the sentences (see comment below).
Thank you!
Sorry, something went wrong.
| default *base* is 10. The allowed bases are 0 and 2--36. Base-2, -8, and -16 | ||
| strings can be optionally prefixed with ``0b``/``0B``, ``0o``/``0O``, or | ||
| ``0x``/``0X``, as with integer literals in code. For base 0, the string is | ||
| interpreted in a similar to an :ref:`integer literal in code <integers>`, in |
There was a problem hiding this comment.
Missing a word here? Maybe "in a similar way", or "in a similar manner", or just "similarly"
Sorry, something went wrong.
|
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. |
Sorry, something went wrong.
|
Thanks @hauntsaninja for the PR 🌮🎉.. I'm working now to backport this PR to: 3.10, 3.11. |
Sorry, something went wrong.
|
GH-100674 is a backport of this pull request to the 3.11 branch. |
Sorry, something went wrong.
|
GH-100675 is a backport of this pull request to the 3.10 branch. |
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.