Skip to content
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

Use f-strings in asyncio-task code examples #10035

Merged
merged 1 commit into from
Oct 24, 2018
Merged

Conversation

Mariatta
Copy link
Member

Replace str.format with f-strings in the code examples of asyncio-task documentation.

Replace str.format with f-strings in the code examples of asyncio-task documentation.
@serhiy-storchaka
Copy link
Member

Does this make the code simpler?

I would rather replace

print('The coroutine raised an exception: {!r}'.format(exc))

with

print('The coroutine raised an exception:', repr(exc))

1 similar comment
@serhiy-storchaka
Copy link
Member

Does this make the code simpler?

I would rather replace

print('The coroutine raised an exception: {!r}'.format(exc))

with

print('The coroutine raised an exception:', repr(exc))

@Mariatta
Copy link
Member Author

I prefer f-strings. Other examples in the page are already using f-strings.

(Since GitHub was having issues yesterday, I'm closing and re-opening this to re-trigger some of the CI)

@Mariatta Mariatta closed this Oct 22, 2018
@Mariatta Mariatta reopened this Oct 22, 2018
Copy link
Contributor

@asvetlov asvetlov left a comment

Choose a reason for hiding this comment

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

Let's use f-strings for sake of uniformness.

@miss-islington
Copy link
Contributor

Thanks @Mariatta for the PR, and @vstinner for merging it 🌮🎉.. I'm working now to backport this PR to: 3.7.
🐍🍒⛏🤖

@vstinner vstinner deleted the Mariatta-patch-1 branch October 24, 2018 22:37
@bedevere-bot
Copy link

GH-10083 is a backport of this pull request to the 3.7 branch.

miss-islington pushed a commit to miss-islington/cpython that referenced this pull request Oct 24, 2018
Replace str.format with f-strings in the code examples of asyncio-task documentation.
(cherry picked from commit 9f43fbb)

Co-authored-by: Mariatta <Mariatta@users.noreply.github.com>
@vstinner
Copy link
Member

Does this make the code simpler?

IMHO the change makes the code easier to read (str.format => f-string).

About f-string vs str % args... Well, that's a matter of taste. I'm not sure that there is a strong argument for one style or the other. I tend to prefer f-string. IMHO it's simpler to read.

@mariatta-bot
Copy link

Mariatta was mentioned, but she's out of open source for the rest of September 2018, and parts of October 2018 . Be aware she might not get to this until November 2018.
(I'm a bot)

miss-islington added a commit that referenced this pull request Oct 24, 2018
Replace str.format with f-strings in the code examples of asyncio-task documentation.
(cherry picked from commit 9f43fbb)

Co-authored-by: Mariatta <Mariatta@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants