Back to Intellij Community

PyListCreationInspection

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

2025.3-rc-2245 B
Original Source

Reports cases when a list declaration can be rewritten with a list literal.

This ensures better performance of your application.

Example:

l = [1]
l.append(2)

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

l = [1, 2]