GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Feature/replace list comp with generator by zkneupper · Pull Request #26046 · python/cpython

Conversation

@zkneupper

@zkneupper zkneupper commented May 11, 2021

Copy link
Copy Markdown
Contributor

Replace list comprehensions with generator expressions inside str.join()

  • Replace list comprehensions with generator expressions inside str.join() in several places in Lib/_pydecimal.py and Lib/argparse.py
  • Replace a for loop with generator expression in Lib/ast.py

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Zachary Kneupper added 8 commits May 11, 2021 18:17
Zachary Kneupper Zachary Kneupper
Use generator as argument to str.join() instead of list comprehension
e0a083c
Zachary Kneupper Zachary Kneupper
Use generator as argument to str.join() instead of list comprehension
23bf120
Zachary Kneupper Zachary Kneupper
Use generator as argument to str.join() instead of list comprehension
29fba8d
Zachary Kneupper Zachary Kneupper
Use generator as argument to str.join() instead of list comprehension
5968060
Zachary Kneupper Zachary Kneupper
Use generator as argument to str.join() instead of list comprehension
7930116
Zachary Kneupper Zachary Kneupper
Use generator as argument to str.join() instead of list comprehension
128783e
Zachary Kneupper Zachary Kneupper
Use generator as argument to str.join() instead of list comprehension
0408882
Zachary Kneupper Zachary Kneupper
replace for loop with generator expression
44915e1
@zkneupper
zkneupper requested review from isidentical and rhettinger as code owners May 11, 2021 22:40
@bedevere-bot bedevere-bot added the awaiting review label May 11, 2021
@the-knights-who-say-ni

the-knights-who-say-ni commented May 11, 2021

Copy link
Copy Markdown

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 username

We couldn't find a bugs.python.org (b.p.o) account corresponding to the following GitHub usernames:

@zkneupper

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!

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@the-knights-who-say-ni the-knights-who-say-ni added the CLA not signed label May 11, 2021
@erlend-aasland

erlend-aasland commented May 12, 2021 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Contributor

Hi, and thank you for your interest in making CPython faster. Unfortunately, these changes are de-optimisations; list comprehensions are faster than generators. See Serhiy's review comment in #25798 (comment)

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

isidentical
isidentical requested changes May 12, 2021
View reviewed changes

@isidentical isidentical left a comment

Copy link
Copy Markdown
Member

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.

This is making the code look worse for the _pad_whitespace. Thanks for the contribution (are these automated?) though please refrain from posting this kind of changes in the future for the different parts of the codebase. If you know a potential improvement, open an issue and send a PR for that issue only.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

erlend-aasland reacted with thumbs up emoji
All reactions
  • 👍 1 reaction
@bedevere-bot bedevere-bot added awaiting changes and removed awaiting review labels May 12, 2021
@bedevere-bot

bedevere-bot commented May 12, 2021

Copy link
Copy Markdown

A Python core developer has requested some changes be made to your pull request before we can consider merging it. If you could please address their requests along with any other requests in other reviews from core developers that would be appreciated.

Once you have made the requested changes, please leave a comment on this pull request containing the phrase I have made the requested changes; please review again. I will then notify any core developers who have left a review that you're ready for them to take another look at this pull request.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@isidentical isidentical closed this May 12, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@isidentical isidentical isidentical requested changes
@rhettinger rhettinger Awaiting requested review from rhettinger

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

awaiting changes

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

5 participants

@zkneupper @the-knights-who-say-ni @erlend-aasland @bedevere-bot @isidentical
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.