PY-COLL0003 · examples
These examples come directly from PY-COLL0003. Read their source.
Bad
A local `formats = ("json", "toml")` a loop is the only reader of is reported as a listcandidate under the default preference. A list of distinct values read only by`value in formats` is a set candidate.
GoodA coordinate tuple unpacked into x, y, a tuple used as a dictionary key, an ordered list that
is indexed, a mixed ("json", 2), and a frozen return snapshot retain their representation. A
literal that is looped over once and indexed once is left alone as well, since indexing is a
read the recommended form would not answer.