[issue13480] range exits loop without action when start is higher than end
R. David Murray
report at bugs.python.org
Fri Nov 25 15:59:31 CET 2011
R. David Murray <rdmurray at bitdance.com> added the comment:
Nope. If you want to count backward, use a negative step. Not doing anything if end is lower than start allows code to take advantage of "don't care" edge cases, just like 'abc'[4:] returning the empty string does. Range is often used in 'for' loops, so having the loop not execute if the computed end is less than the computed start is an intentional and important feature.
----------
nosy: +r.david.murray
resolution: -> invalid
stage: -> committed/rejected
status: open -> closed
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue13480>
_______________________________________
More information about the Python-bugs-list
mailing list