.. _consider-using-dict-comprehension: consider-using-dict-comprehension / R1717 ========================================= **Message emitted:** ``Consider using a dictionary comprehension`` **Description:** *Emitted when we detect the creation of a dictionary using the dict() callable and a transient list. Although there is nothing syntactically wrong with this code, it is hard to read and can be simplified to a dict comprehension. Also it is faster since you don't need to create another transient list* **Problematic code:** .. literalinclude:: /data/messages/c/consider-using-dict-comprehension/bad.py :language: python **Correct code:** .. literalinclude:: /data/messages/c/consider-using-dict-comprehension/good.py :language: python **Additional details:** pyupgrade_ or ruff_ can fix this issue automatically. .. _pyupgrade: https://github.com/asottile/pyupgrade .. _ruff: https://docs.astral.sh/ruff/ Created by the `refactoring `__ checker.