FURB122 autofix rewrites loop targets into generator scope
@sungodtemple▲ 0 net votes
The for-loop-writes fix converts the loop body to a generator expression, which nests the loop target in a new scope. It is a false positive when the target is declared global or nonlocal, or when the variable is read after the loop, because the rewrite changes behavior. Review FURB122 fixes for any loop whose target leaks outside the comprehension before accepting them.