-
-
Notifications
You must be signed in to change notification settings - Fork 31.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
gh-71494: string.Formatter unnumbered key/attributes #21767
gh-71494: string.Formatter unnumbered key/attributes #21767
Conversation
Hello, and thanks for your contribution! I'm a bot set up to make sure that the project can legally accept this contribution by verifying everyone involved has signed the PSF contributor agreement (CLA). Recognized GitHub usernameWe couldn't find a bugs.python.org (b.p.o) account corresponding to the following GitHub usernames: This might be simply due to a missing "GitHub Name" entry in one's b.p.o account settings. This is necessary for legal reasons before we can look at this contribution. Please follow the steps outlined in the CPython devguide to rectify this issue. You can check yourself to see if the CLA has been received. Thanks again for the contribution, we look forward to reviewing it! |
Blurb is trivial, but just in case the following one can be used:
|
Rationale: we need to preserve the reenterability (which I think is important, e.g. in the looging use cases), and also not break the existing user subclasses that expect The alternative would be to add the missing reference in the |
638aceb
to
3a4440e
Compare
3a4440e
to
bfef488
Compare
bfef488
to
7d1522e
Compare
I see now that you have copied Personally, I like your changes, but for this to go through it would probably be best to only leave what is necessary. Which to me seems to be limited to |
c4b847d
to
4bb189e
Compare
I am starting to remember my motivation for separate class and method: it was to provide access to corresponding parts to the user for further customization. I think nobody uses I went ahead and made the change absolutely minimal which should address all of the issues raised in your comments. If somebody needs additional entry points for customization they are always welcome to submit a pull request :))) Please tell if you like the new version better. |
That was my starting point as well. I have a use case in mind for which these changes don't cut it. Then I thought of something along the lines of Long story short, I will spend some more time, maybe there is some good path forward. If there is not, simply pushing minimal bug fix is probably better than nothing at all. |
I think this is great. |
Misc/NEWS.d/next/Library/2020-08-07-16-55-57.bpo-27307.Xqzzda.rst
Outdated
Show resolved
Hide resolved
4bb189e
to
806199e
Compare
Have you seen PEP750? I feel like any new work on custom formatters should make use of t-strings (but interestingly some examples there still subclass good old |
806199e
to
068deb5
Compare
Good point. t-strings will (hopefully) be great. Unfortunately, it will be a while before I will be able to use them. In any case, I think this specific PR is useful. From my POV it fixes a bug. See: #129273 (comment) |
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.
LGTM
068deb5
to
1e55873
Compare
I think this is worth mentioning.
|
1e55873
to
a493f9c
Compare
(Apologies for rebasing in the same change as fixing the issue, here is the relevant change.) |
No problem; thank you for the contribution! |
The reproducer in #89867 still behaves as before. I don't currently have time to look into the details there. |
I'll treat this as a feature and not backport. Let me know if you want to reconsider. |
You are right, it is not the same thing, I misread it. However, I had a look at it and that request IMO is a no-go. The reason for it is clear and unambiguous. |
Fine by me. Thank you for quick turnaround! |
https://bugs.python.org/issue27307