Skip to content

Conversation

@hugovk
Copy link
Member

@hugovk hugovk commented Dec 3, 2023

Changes proposed in this pull request:

  • Replace some for loops with list comprehensions
  • Identified with ruff . --select PERF401: "PERF401 Use a list comprehension to create a transformed list"
  • https://docs.astral.sh/ruff/rules/manual-list-comprehension/
  • It finds some that can't be easily replaced, so I didn't add this rule to pyproject.toml
v.append(functools.reduce(operator.add, self.h[i : i + 256]))
return v
return [
functools.reduce(operator.add, self.h[i : i + 256])
Copy link
Member

Choose a reason for hiding this comment

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

hugovk and others added 2 commits December 4, 2023 16:34
Co-authored-by: Andrew Murray <3112309+radarhere@users.noreply.github.com> Co-authored-by: Alexander Karpinsky <homm86@gmail.com>
Co-authored-by: Andrew Murray <3112309+radarhere@users.noreply.github.com>
@radarhere radarhere merged commit 0a66b98 into python-pillow:main Dec 5, 2023
@hugovk hugovk deleted the comprehensions branch December 5, 2023 10:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

5 participants