-
-
Notifications
You must be signed in to change notification settings - Fork 30.1k
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
f-string's "debug" feature is undocumented #85217
Comments
The feature of f-strings using '=' for "debugging" formatting is not documented. >>> foo = 'bar'
>>> f'{foo=}'
"foo='bar'" I'm not sure where this should fit in to the documentation, but it needs to be in there somewhere. Basically the documentation needs to say:
>>> f'{foo=:20}'
'foo=bar '
>>> f'{foo=!r:20}'
"foo='bar' " |
Every other detail about f-strings is spelled out meticulously in the reference manual: https://docs.python.org/3/reference/lexical_analysis.html#formatted-string-literals I think it needs to be added here. PS OT: I can't find anything about f-strings in pydoc. |
Hello all, Could I help by adding this to the documentation ? |
@rishi93: yes, please do! |
Thank you very much. I have made a pull request. Looking forward to your review on my first open-source contribution :) |
Hello all, I have attempted to resolve this issue by adding some comments to PR21464 and later provided a reworded PR21509 that attempts to resolve this using ideas from @rishi93. Finally I have tried to document f-string within pydoc itself with PR21552. I request please that they be marked with skip-news. Also request feedback on the PRs. |
I've reviewed your first PR (bpo-21509). Regarding your second one, I think there's a misunderstanding. With "pydoc" I didn't mean "the Python docs". IMO the documentation of f-strings in the language reference is sufficient, there's no need for another section about it in the library reference. What I meant was that the pydoc module doesn't have any text about f-strings. The help() builtin calls pydoc.help(), and there are some special topics that you can invoke whose source text is generated Let me know if you need more help (I had a fun hour figuring out how all this works :-). |
I was just just trying to link to someone the documentation for f-strings, but:
I think we should:
If you think this is out of the scope of this issue, I can open a separate one. |
Those are really good observations and proposals, Ezio! I agree that it might be better to separate them into a new issue. Can you also review #21552 (the second PR here by amaajemyfren)? Maybe it would actually make a good candidate for part (4) of your proposed solutions. @ama Aje My Fren: please look at my review of #21509 and implement my suggestions, then we can merge that one and close *this* issue. |
I created bpo-41411. |
I am looking at the pydoc issue now. It will take me more than an hour but I will figure it. Can that be under this issue also or (since you raised it as an OT) make that another issue? |
Thanks Ama Aje My Fren! You can transfer your other PR to a different bpo issue by editing the subject on GitHub. |
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
bugs.python.org fields:
The text was updated successfully, but these errors were encountered: