.. _use-sequence-for-iteration: use-sequence-for-iteration / C0208 ================================== **Message emitted:** ``Use a sequence type when iterating over values`` **Description:** *When iterating over values, sequence types (e.g., ``lists``, ``tuples``, ``ranges``) are more efficient than ``sets``.* **Problematic code:** .. literalinclude:: /data/messages/u/use-sequence-for-iteration/bad.py :language: python **Correct code:** ``list.py``: .. literalinclude:: /data/messages/u/use-sequence-for-iteration/good/list.py :language: python ``tuple.py``: .. literalinclude:: /data/messages/u/use-sequence-for-iteration/good/tuple.py :language: python **Additional details:** https://gist.github.com/hofrob/8b1c1e205a0d4c66a680b1fe4bfeba11 This example script shows a significant increase in performance when using a list, tuple or range over a set in python version 3.11.1. Created by the `refactoring `__ checker.