{
"id": "py-linear-membership-in-loop",
"language": "python",
"group": "performance",
"listingTitle": "Avoid repeated Python list membership scans",
"title": "Avoid repeated Python list membership scans",
"mvvm": false,
"defaultSeverity": "warn",
"legacyGroup": "performance",
"why": "List membership is linear, so checking the same list inside another loop can create quadratic work.",
"suggestion": "Convert the lookup collection to a set before the loop when ordering and duplicates are not part of the membership semantics.",
"version": 1,
"semanticMaturity": "token",
"securityKind": "none",
"taxonomy": ["performance"],
"requirements": ["sourceText"],
"packs": ["python"],
"implementation": "src/languages/python/rules.rs",
"languages": ["python"],
"frameworks": [],
"languageVersions": [],
"limitations": [
"Only variables explicitly annotated as list or List, or assigned a list literal or list constructor, are tracked.",
"Collection size, reassignment, variable shadowing, and intentionally small lookup lists are not inferred."
]
}