mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-18 22:17:05 +07:00
PY-3569 Inspection to warn if a loop variable is assigned inside the loop
22 lines
582 B
HTML
22 lines
582 B
HTML
<html>
|
|
<body>
|
|
<span style="font-family: verdana,serif;">
|
|
Checks for cases when you rewrite loop variable with inner loop
|
|
</span>
|
|
<pre style="font-family: monospace">
|
|
for i in xrange(5):
|
|
for i in xrange(20, 25):
|
|
print("Inner", i)
|
|
print("Outer", i)
|
|
</pre>
|
|
<span style="font-family: verdana,serif;">
|
|
It also warns you if variable declared in <code>with</code> statement is redeclared inside of statement body:
|
|
</span>
|
|
<pre style="font-family: monospace">
|
|
with open("file") as f:
|
|
f.read()
|
|
with open("file") as f:
|
|
</pre>
|
|
</body>
|
|
</html>
|