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 yield from instead of looping yield #6170

Merged
merged 1 commit into from
Jun 29, 2022
Merged

Use yield from instead of looping yield #6170

merged 1 commit into from
Jun 29, 2022

Conversation

kkirsche
Copy link
Contributor

This merge request updates the stream yield functionality to use yield from instead of yield within a for loop. Because this is yielding from an iterable, we can use yield from which is not only slightly shorter but also on average 15% more performant than using yield inside of a loop. This is a result of some of the optimizations included as part of PEP 380

This merge request updates the stream yield functionality to use `yield from` instead of `yield` within a for loop. Because this is yielding from an iterable, we can use `yield from` which is not only slightly shorter but also on average 15% more performant than using `yield` inside of a loop. This is a result of some of the optimizations included as part of [PEP 380](https://peps.python.org/pep-0380/)
Copy link
Member

@nateprewitt nateprewitt 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 do it, thanks @kkirsche!

@nateprewitt nateprewitt merged commit 16b418b into psf:main Jun 29, 2022
@nateprewitt nateprewitt mentioned this pull request Jun 29, 2022
@kkirsche
Copy link
Contributor Author

Yep, part of splitting up #6165 to get past that...feedback

@kkirsche kkirsche deleted the patch-1 branch June 29, 2022 15:22
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jun 30, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants