How about checking that you're not using a list for an in?
Open
Nobody has claimed this yet.
enhancement
- Dominant language
- Python
- Stars
- 1.1k
- Forks
- 123
- Avg merge
- 2d 5h
- Merged PRs (30d)
- 5
Description
A very common pattern:
candidates = [some for some in another_stuff()]
if me in candidates:
do_stuff()
If candidates is only used for an in, then we have 2 alternatives that are going to be more performant than the above in 100% of the cases:
Using a generator:
-candidates = [some for some in another_stuff()]
+candidates = (some for some in another_stuff())
Or using a set:
-candidates = [some for some in another_stuff()]
+candidates = {some for some in another_stuff()}
How about linting this?
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
No repository files, tests, or entry points are named. Start by reviewing the existing Python lint-rule structure and determine how to identify list comprehensions used only for membership checks; the work is done when this pattern produces a documented warning without flagging cases where list semantics are needed.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- tooling
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100