Skip to content

Minor refactor: Unnecessary list comprehension#8670

Merged
lovelydinosaur merged 1 commit into
encode:masterfrom
ahzamm:master
Sep 26, 2022
Merged

Minor refactor: Unnecessary list comprehension#8670
lovelydinosaur merged 1 commit into
encode:masterfrom
ahzamm:master

Conversation

@ahzamm
Copy link
Copy Markdown
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.

@lovelydinosaur
Copy link
Copy Markdown
Contributor

Sure, thanks.

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

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
Copy Markdown
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.

3 participants