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
bpo-33828: Add missing versionchanged note for string.Formatter. #7668
Conversation
string.Formatter auto-numbering feature was added in 3.4 and there is no versionchanged not in its documentation, making the documentation ambiguous about which version the feature is available.
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.
A few small comments, but otherwise looks good.
Doc/library/string.rst
Outdated
@@ -231,8 +231,11 @@ attribute using :func:`getattr`, while an expression of the form ``'[index]'`` | |||
does an index lookup using :func:`__getitem__`. | |||
|
|||
.. versionchanged:: 3.1 | |||
The positional argument specifiers can be omitted, so ``'{} {}'`` is | |||
equivalent to ``'{0} {1}'``. | |||
The positional argument specifiers can be omitted, for :meth:`str.format`, |
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 would delete the first comma in that sentence.
Doc/library/string.rst
Outdated
so ``'{} {}'`` is equivalent to ``'{0} {1}'``. | ||
|
||
.. versionchanged:: 3.4 | ||
The positional argument specifiers can be omitted, for :class:`Formatter`. |
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.
Similarly, I would delete the comma in this sentence.
Doc/library/string.rst
Outdated
The positional argument specifiers can be omitted, so ``'{} {}'`` is | ||
equivalent to ``'{0} {1}'``. | ||
The positional argument specifiers can be omitted, for :meth:`str.format`, | ||
so ``'{} {}'`` is equivalent to ``'{0} {1}'``. |
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.
Since you're now referencing both str.format()
and Formatter
in close proximity, I'd change this example to actually reference .format()
. So something like: '"{} {}'.format(a, b) is equivalent to '{0} {1}'.format(a, b)"
.
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.
Looks good to me. Thanks!
Thanks @zhangyangyu for the PR 🌮🎉.. I'm working now to backport this PR to: 2.7, 3.6, 3.7. |
GH-7674 is a backport of this pull request to the 3.7 branch. |
…honGH-7668) string.Formatter auto-numbering feature was added in 3.4 and there is no versionchanged note in its documentation, making the documentation ambiguous about which version the feature is available. (cherry picked from commit b9d8ad5) Co-authored-by: Xiang Zhang <angwerzx@126.com>
GH-7675 is a backport of this pull request to the 3.6 branch. |
…honGH-7668) string.Formatter auto-numbering feature was added in 3.4 and there is no versionchanged note in its documentation, making the documentation ambiguous about which version the feature is available. (cherry picked from commit b9d8ad5) Co-authored-by: Xiang Zhang <angwerzx@126.com>
Sorry, @zhangyangyu, I could not cleanly backport this to |
Actually, I'm not sure this should be backported to 2.7. Do we normally document Python 3 changes there? I'm not sure the Formatter change got made to 2.7. |
GH-7668) string.Formatter auto-numbering feature was added in 3.4 and there is no versionchanged note in its documentation, making the documentation ambiguous about which version the feature is available.
GH-7676 is a backport of this pull request to the 2.7 branch. |
@ericvsmith No, it's not backport. We won't mention the Python 3 feature in Python 2 doc. But I would like to make it clear that the feature is only available to |
string.Formatter auto-numbering feature was added in 3.4 and there
is no versionchanged not in its documentation, making the documentation
ambiguous about which version the feature is available.
https://bugs.python.org/issue33828