Skip to content

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

Closed
wants to merge 12 commits into from

Conversation

amaajemyfren
Copy link
Contributor

@amaajemyfren amaajemyfren commented Jul 19, 2020

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

First attempt at documenting f-strings within the Python Docs and not in reference documents.
Copy link
Member

@ezio-melotti ezio-melotti left a 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.

@bedevere-bot
Copy link

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 I have made the requested changes; please review again. I will then notify any core developers who have left a review that you're ready for them to take another look at this pull request.

@gvanrossum gvanrossum changed the title bpo-41045: Documenting of f-strings within pydocs. bpo-41045: Document f-strings in library/stdtypes.rst Jul 28, 2020
Added intermediate description of f-strings in stdtypes documentation.
@amaajemyfren amaajemyfren changed the title bpo-41045: Document f-strings in library/stdtypes.rst bpo-41411: Document f-strings in library/stdtypes.rst Jul 28, 2020
@amaajemyfren
Copy link
Contributor Author

I have made the requested changes; please review again

@bedevere-bot
Copy link

Thanks for making the requested changes!

@ezio-melotti: please review the changes made to this pull request.

Copy link
Member

@ezio-melotti ezio-melotti left a 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.

@bedevere-bot
Copy link

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 I have made the requested changes; please review again. I will then notify any core developers who have left a review that you're ready for them to take another look at this pull request.

And if you don't make the requested changes, you will be poked with soft cushions!

@amaajemyfren
Copy link
Contributor Author

I have made the requested changes; please review again

@bedevere-bot
Copy link

Thanks for making the requested changes!

@ezio-melotti: please review the changes made to this pull request.

Copy link
Member

@ericvsmith ericvsmith left a 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::
Copy link
Member

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"?

@AA-Turner AA-Turner changed the title bpo-41411: Document f-strings in library/stdtypes.rst gh-85583: Document f-strings in library/stdtypes.rst Jan 12, 2024
@AA-Turner AA-Turner self-requested a review January 23, 2024 00:51
@serhiy-storchaka serhiy-storchaka added needs backport to 3.13 bugs and security fixes and removed needs backport to 3.11 only security fixes labels May 9, 2024
@hugovk hugovk removed the needs backport to 3.12 only security fixes label Apr 10, 2025
@python-cla-bot
Copy link

The following commit authors need to sign the Contributor License Agreement:

CLA signed

@skirpichev skirpichev self-requested a review April 18, 2025 12:46
@AA-Turner
Copy link
Member

This is now very out of date with the changes in 3.12. I've rebased, rewritten, and reopened as #132689.

A

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
awaiting changes docs Documentation in the Doc dir needs backport to 3.13 bugs and security fixes skip news
Projects
Status: Todo
Development

Successfully merging this pull request may close these issues.

9 participants