Skip to content

Conversation

@Flamefire
Copy link
Contributor

https://pypi.org/project/flake8-comprehensions/ has various useful checks, most importantly:

C419 Unnecessary list comprehension in <any/all>() prevents short-circuiting - rewrite as a generator.

I.e. things like any([expensive_check(x) for x in collection]) runs the check after processing the full collection instead of stopping after the first "match" which costs performance.

To me the whole collection of checks look useful for performance and readability so enable them all.

returns the current threads name
"""
return threading.currentThread().getName()
return threading.current_thread().name
Copy link
Member

Choose a reason for hiding this comment

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

Both currentThread() and getName() are deprecated, so makes sense to stop using those since they're bound to be removed at some point, see https://docs.python.org/3/library/threading.html#threading.current_thread and https://docs.python.org/3/library/threading.html#threading.Thread.getName

Copy link
Member

@boegel boegel left a comment

Choose a reason for hiding this comment

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

lgtm

@boegel boegel changed the title CI: Enable flake8-comprehension and fix issues Enable flake8-comprehension code style check and fix issues Nov 19, 2025
@boegel boegel merged commit 76e684d into easybuilders:develop Nov 19, 2025
39 checks passed
@Flamefire Flamefire deleted the comprehensions branch November 20, 2025 09:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants