Skip to content

CSP-P012: Use Tuple for Immutable Constant List

Category: Performance

Severity: LOW

Description

Immutable constant lists can use tuples to reduce overhead and signal immutability.

Vulnerable Code Example

ALLOWED = ["a", "b", "c"]

Safer Code Example

ALLOWED = ("a", "b", "c")

How to Suppress a Finding

# ignore
# or
# noqa: CSP-P012