-
-
Notifications
You must be signed in to change notification settings - Fork 31.7k
gh-85583: Document f-strings in library/stdtypes.rst #21552
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
Conversation
First attempt at documenting f-strings within the Python Docs and not in reference documents.
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.
Thanks for the PR, I left a few comments.
A Python core developer has requested some changes be made to your pull request before we can consider merging it. If you could please address their requests along with any other requests in other reviews from core developers that would be appreciated. Once you have made the requested changes, please leave a comment on this pull request containing the phrase |
Added intermediate description of f-strings in stdtypes documentation.
I have made the requested changes; please review again |
Thanks for making the requested changes! @ezio-melotti: please review the changes made to this pull request. |
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.
I added a couple of comments, but most of the PR might become obsolete once we reorganize the docs as discussed on bpo-41411. Before doing further changes to this PR I would wait until we decided what to do.
A Python core developer has requested some changes be made to your pull request before we can consider merging it. If you could please address their requests along with any other requests in other reviews from core developers that would be appreciated. Once you have made the requested changes, please leave a comment on this pull request containing the phrase And if you don't make the requested changes, you will be poked with soft cushions! |
Change the format of table to simplified form. Co-authored-by: Ezio Melotti <[email protected]>
I have made the requested changes; please review again |
Thanks for making the requested changes! @ezio-melotti: please review the changes made to this pull request. |
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.
I think somewhere this should mention that the __format__
mechanism is the same one used with str.format()
. I'm not sure where to put it.
'The string PYTHON contains 6 characters.' | ||
|
||
By default the :func:`str` format of a variable is presented when using | ||
f-strings:: |
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 isn't technically true, but I don't know if we want to just provide a "you can think of it this way" guide, or go into the real details.
An object's __format__()
method can do anything. By convention, if there's no format specifier the object's __format__()
will return str(obj)
, but it's not a requirement.
Maybe change "By default" to "Typically", or "By convention"?
The following commit authors need to sign the Contributor License Agreement: |
This is now very out of date with the changes in 3.12. I've rebased, rewritten, and reopened as #132689. A |
An attempt at documenting f-strings within the Python Docs and not in reference documents.
@gvanrossum raised the documentation gap—that there is no f-string documentation outside the reference documents.
https://bugs.python.org/issue41411