Skip to content

Conversation

@rishi93
Copy link
Contributor

@rishi93 rishi93 commented Jul 13, 2020

Missing documentation describing the = specifier for f-strings has been added

https://bugs.python.org/issue41045

Missing documentation describing the = specifier for f-strings has been added
>>> foo.__doc__ is None
True

F-strings can also help with "printf-style" debugging.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this needs to at least describe the feature. See my 2 points in bpo-41045 for what I think needs to be included.

@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.

Added more examples to explain f-string's self documenting expressions when format specifiers are used
@rishi93
Copy link
Contributor Author

rishi93 commented Jul 13, 2020

I have made the requested changes; please review again

@bedevere-bot
Copy link

Thanks for making the requested changes!

@ericvsmith: please review the changes made to this pull request.

@bedevere-bot bedevere-bot requested a review from ericvsmith July 13, 2020 18:57
Corrected typos with single and double quotes in the f-string's examples
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 this still needs some polishing, but I'm not very good at writing documentation. Hopefully someone else will respond with some suggestions.

Copy link
Contributor

@amaajemyfren amaajemyfren 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 the line

replacement_field: "{" `f_expression` ["!" `conversion`] [":" `format_spec`] "}"

Should be changed to

replacement_field: "{" `f_expression` ["="] ["!" `conversion`] [":" `format_spec`] "}"

>>> foo.__doc__ is None
True

F-strings can also help with "printf-style" debugging.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey @rishi93,

Would you consider adding that this is new from version 3.8?

Optional format specifiers can be placed after the equals sign.
If no format specifiers are used then :meth:`repr` is used on the expression.
If format specifier (like :20) is given, then :meth:`str` is used on the
expression. You can use the repr() with the !r format specifier
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey @rishi93,

I think !r is a conversion not a format specifier.

@amaajemyfren
Copy link
Contributor

Hey @rishi93 and @ericvsmith,

I have done this file and would like to hear your view of it. I was thinking of doing a PR of it but wanted your opinions first.

@rishi93
Copy link
Contributor Author

rishi93 commented Jul 20, 2020

@amaajemyfren, I will close this PR, you can open a new PR with your changes. Thank you for your effort.

@rishi93 rishi93 closed this Jul 20, 2020
@rishi93 rishi93 deleted the fix-issue-41045 branch July 20, 2020 07:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants