Inspectopedia Help

Dictionary creation can be rewritten by dictionary literal

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

This approach brings performance improvements.


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

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

dic = {'var': 1}

Inspection Details

Available in:

DataSpell 2023.3, PyCharm 2023.3


Python Community Edition, 233.SNAPSHOT

Last modified: 13 July 2023