Back to Intellij Community

PyDictCreationInspection

python/python-psi-impl/resources/inspectionDescriptions/PyDictCreationInspection.html

2025.3-rc-2264 B
Original Source

Reports situations when you can rewrite dictionary creation by using a dictionary literal.

This approach brings performance improvements.

Example:

dic = {}
dic['var'] = 1

When the quick-fix is applied, the code changes to:

dic = {'var': 1}