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

Minor refactor: Unnecessary list comprehension #8670

Merged
merged 1 commit into from Sep 26, 2022
Merged

Minor refactor: Unnecessary list comprehension #8670

merged 1 commit into from Sep 26, 2022

Conversation

ahzamm
Copy link
Contributor

@ahzamm ahzamm commented Sep 25, 2022

Unnecessary list comprehension. Refactored using list().

Both perform the same task but in
[line for line in description.splitlines()]
You manually iterate over description causing heigh time complexity.

@tomchristie
Copy link
Member

Sure, thanks.

@tomchristie tomchristie changed the title Unnecessary list comprehension Minor refactor: Unnecessary list comprehension Sep 26, 2022
@tomchristie tomchristie merged commit 73f4835 into encode:master Sep 26, 2022
@joncle
Copy link

joncle commented Sep 26, 2022

Since .splitlines() already returns a list and nothing's happening to require a copy - why is list even needed here?

@ahzamm
Copy link
Contributor Author

ahzamm commented Sep 27, 2022

Thanks, @joncle for pointing this out. I have refactored this and submitted this pullrequest.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants