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
Docs: Link tokens in the format string grammars #108184
Docs: Link tokens in the format string grammars #108184
Conversation
Fix links from Format String Syntax grammar and Format Specification Mini-Language grammar to Python grammar. Also link `arg_name` token within Format String Syntax grammar.
|
Looks like the links to |
|
@wjandrea, could you, please, resolve merge conflicts? BTW, shouldn't we also bug sphinx-doc (I don't see related issue(s))? |
This add hexadecimal floating point literals (IEEE 754-2008 §5.12.3) and
support construction of floats from hexadecimal strings. Note that the
float constructor accepts more permissive syntax (everything that is
currently accepted by the float.fromhex, but with a mandatory base
specifier; it also allows grouping digits with underscores).
Examples:
```pycon
>>> 0x1.1p-1
0.53125
>>> float('0x1.1')
1.0625
>>> 0x1.1
File "<stdin>", line 1
0x1.1
^
SyntaxError: invalid floating point literal
```
Minor changes:
* Py_ISDIGIT/ISXDIGIT macros were transformed to functions
* cherry-picked sphinx workaround from python#108184
This add hexadecimal floating point literals (IEEE 754-2008 §5.12.3) and
support construction of floats from hexadecimal strings. Note that the
float constructor accepts more permissive syntax (everything that is
currently accepted by the float.fromhex, but with a mandatory base
specifier; it also allows grouping digits with underscores).
Examples:
```pycon
>>> 0x1.1p-1
0.53125
>>> float('0x1.1')
1.0625
>>> 0x1.1
File "<stdin>", line 1
0x1.1
^
SyntaxError: invalid floating point literal
```
Minor changes:
* Py_ISDIGIT/ISXDIGIT macros were transformed to functions
* cherry-picked sphinx workaround from python#108184
|
@skirpichev merge conflicts resolved |
|
LGTM, except for two nitpicks |
Co-authored-by: Sergey B Kirpichev <skirpichev@gmail.com>
|
Thanks @wjandrea for the PR, and @AA-Turner for merging it 🌮🎉.. I'm working now to backport this PR to: 3.11, 3.12. |
(cherry picked from commit f3d5d4a) Co-authored-by: William Andrea <william.j.andrea@gmail.com> Co-authored-by: Adam Turner <9087854+aa-turner@users.noreply.github.com> Co-authored-by: Sergey B Kirpichev <skirpichev@gmail.com>
(cherry picked from commit f3d5d4a) Co-authored-by: William Andrea <william.j.andrea@gmail.com> Co-authored-by: Adam Turner <9087854+aa-turner@users.noreply.github.com> Co-authored-by: Sergey B Kirpichev <skirpichev@gmail.com>
|
GH-113839 is a backport of this pull request to the 3.12 branch. |
|
GH-113840 is a backport of this pull request to the 3.11 branch. |
This add hexadecimal floating point literals (IEEE 754-2008 §5.12.3) and
support construction of floats from hexadecimal strings. Note that the
float constructor accepts more permissive syntax (everything that is
currently accepted by the float.fromhex, but with a mandatory base
specifier; it also allows grouping digits with underscores).
Examples:
```pycon
>>> 0x1.1p-1
0.53125
>>> float('0x1.1')
1.0625
>>> 0x1.1
File "<stdin>", line 1
0x1.1
^
SyntaxError: invalid floating point literal
```
Minor changes:
* Py_ISDIGIT/ISXDIGIT macros were transformed to functions
* cherry-picked sphinx workaround from python#108184
This add hexadecimal floating point literals (IEEE 754-2008 §5.12.3) and
support construction of floats from hexadecimal strings. Note that the
float constructor accepts more permissive syntax (everything that is
currently accepted by the float.fromhex, but with a mandatory base
specifier; it also allows grouping digits with underscores).
Examples:
```pycon
>>> 0x1.1p-1
0.53125
>>> float('0x1.1')
1.0625
>>> 0x1.1
File "<stdin>", line 1
0x1.1
^
SyntaxError: invalid floating point literal
```
Minor changes:
* Py_ISDIGIT/ISXDIGIT macros were transformed to functions
* cherry-picked sphinx workaround from python#108184
Fix links from Format String Syntax grammar and Format Specification Mini-Language grammar to Python grammar.
Also link
arg_nametoken within Format String Syntax grammar.Please check my work. I'm not very familiar with RST, just read the docs on
productionlists and did my best.Should be backported to all current versions.
📚 Documentation preview 📚: https://cpython-previews--108184.org.readthedocs.build/en/108184/library/string.html#format-string-syntax