Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions Doc/library/string.rst
Original file line number Diff line number Diff line change
Expand Up @@ -259,9 +259,9 @@ on the value, ``'!r'`` which calls :func:`repr` and ``'!a'`` which calls

Some examples::

"Harold's a clever {0!s}" # Calls str() on the argument first
"Bring out the holy {name!r}" # Calls repr() on the argument first
"More {!a}" # Calls ascii() on the argument first
"Harold's a clever {0!s}" # Calls str() on the first argument
"Bring out the holy {name!r}" # Calls repr() on a named argument
"More {!a}" # Calls ascii() on an implicit argument

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

The examples say "on the argument first", because it's trying to say that !a, !s, and !r are conversions that are called first. That is, they're called before the resulting string is formatted.

I agree that the comments aren't great, but I think any changes need to make this point about conversions being applied first, and your edits lose that. Maybe something like "Calls str() on the argument before formatting the resulting string"? I realize it's a little long.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Okay Eric, that is not how I read it when I encountered it. I can see what you mean about the original. This change is unnecessary then.


The *format_spec* field contains a specification of how the value should be
presented, including such details as field width, alignment, padding, decimal
Expand Down