PY-COLL0003 · evidence
This page continues PY-COLL0003 directly from its source docstring. Read its implementation.
Evidence
Section titled “Evidence”Each finding names the local binding, the form it is written as, how many values it holds, and which of the two proofs its reads satisfy. The rule reports a candidate without a fix because public annotations and downstream behavior can still impose a contract outside the function. The value is the number of local collections whose proven use fixes a clearer representation.
Exceptions
Section titled “Exceptions”Annotated values, module constants, returned values, escaped arguments, indexing, unpacking,
equality, mutation, duplicate membership values, heterogeneous tuples, hash keys, and unknown
uses are excluded, and so is a name the callable rebinds, since the second binding may hold
anything. Fixed heterogeneous records remain tuples. Frozen snapshots and hashable keys remain
tuples or frozen sets even when the project generally prefers lists. sequence_preference is
the form an iteration-only literal is recommended as, defaulting to a list, and setting
prefer_membership_set to false leaves a membership-only literal alone for a project that
would rather keep its order.
References
Section titled “References”- Cites “Fluent Python”, chapter 2, sequences
- Cites “The Python Tutorial”, data structures. Open reference
- Cites “The Python Language Reference”, standard type hierarchy. Open reference