[New-bugs-announce] [issue16571] Iterating over inconsistently-indented code block causes execution of code only on last iteration of loop
Brian Berard
report at bugs.python.org
Wed Nov 28 17:02:00 CET 2012
New submission from Brian Berard:
When a loop (for loop in this case) contains multiple lines of code, if the lines are inconsistently indented, the for loop will only execute those lines on the final pass through the loop with no type of warning regarding indentation error.
Ex.
for i in range(0,10):
print "I will print on every iteration: %d" % i # TAB indented
print "I will only print on the final iteration: %d" % i # 4 spaces
----------
components: Interpreter Core
files: python_test.py
messages: 176551
nosy: dimitriprosser
priority: normal
severity: normal
status: open
title: Iterating over inconsistently-indented code block causes execution of code only on last iteration of loop
type: behavior
versions: Python 2.7
Added file: http://bugs.python.org/file28149/python_test.py
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue16571>
_______________________________________
More information about the New-bugs-announce
mailing list