-
-
Notifications
You must be signed in to change notification settings - Fork 32.5k
gh-135676: Reword the f-string (and t-string) section #137469
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
base: main
Are you sure you want to change the base?
Conversation
Co-authored-by: Blaise Pabon <[email protected]>
Co-authored-by: Adam Turner <[email protected]> Co-authored-by: Blaise Pabon <[email protected]>
>>> number = 14.3 | ||
>>> 'number=14.3' | ||
number=14.3 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This example is wrong, maybe this was intended?:
>>> number = 14.3 | |
>>> 'number=14.3' | |
number=14.3 | |
>>> number = 14.3 | |
>>> f'{number=}' | |
'number=14.3' |
By default, the value of a replacement field expression is converted to | ||
string using :func:`str`:: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
By default, the value of a replacement field expression is converted to | |
string using :func:`str`:: | |
By default, the value of a replacement field expression is converted to | |
a string using :func:`str`:: |
>>> f'{Fraction(1, 3)!s}' | ||
For example:: | ||
|
||
>>> str(one_third) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These example are duplicated, how about merging it all?
Continuing from #135942, this tackles the f-string section.
Much of the information was duplicated in
stdtypes.rst
; this PR keeps lexical/syntactical details in Lexical Analysis and the evaluation & runtime behaviour in Standard types, with cross-references between the two.Since the t-string section only listed differences from f-strings, and the grammar for the two is equivalent, that section was moved to Standard types almost entirely.
📚 Documentation preview 📚: https://cpython-previews--137469.org.readthedocs.build/