Back to Intellij Community

PySetFunctionToLiteralInspection

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

2025.3-rc-2278 B
Original Source

Reports calls to the set function that can be replaced with the set literal.

Example:

def do_mult(a, b):
    c = a * b
    return set([c, a, b])

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

def do_mult(a, b):
    c = a * b
    return {c, a, b}