| Tor Norbye | 814f829 | 2014-03-06 17:27:18 -0800 | [diff] [blame^] | 1 | <html> |
| 2 | <body> |
| 3 | <span style="font-family: verdana,serif;"> |
| 4 | Checks for cases when you rewrite loop variable with inner loop |
| 5 | </span> |
| 6 | <pre style="font-family: monospace"> |
| 7 | for i in xrange(5): |
| 8 | for i in xrange(20, 25): |
| 9 | print("Inner", i) |
| 10 | print("Outer", i) |
| 11 | </pre> |
| 12 | <span style="font-family: verdana,serif;"> |
| 13 | It also warns you if variable declared in <code>with</code> statement is redeclared inside of statement body: |
| 14 | </span> |
| 15 | <pre style="font-family: monospace"> |
| 16 | with open("file") as f: |
| 17 | f.read() |
| 18 | with open("file") as f: |
| 19 | </pre> |
| 20 | </body> |
| 21 | </html> |