redefined-loop-name / W2901#

Message emitted:

Redefining %r from loop (line %s)


Used when a loop variable is overwritten in the loop body.

Correct code:

for name in names:
    lowercased_name = name.lower()

Problematic code:

for name in names:
    name = name.lower()  # [redefined-loop-name]


This message is emitted by the optional 'redefined-loop-name' checker which requires the pylint.extensions.redefined_loop_name plugin to be loaded.

Created by the redefined-loop-name checker.