[New-bugs-announce] [issue13480] range exits loop without action when start is higher than end

Asa Dawson report at bugs.python.org
Fri Nov 25 15:51:35 CET 2011


New submission from Asa Dawson <sunderphon at googlemail.com>:

range has an odd behavior in which it assumes (regardless of start/end) that it should be counting up. Attempting something such as:

for i in range(10,0):
    print i

This loop simply runs through without doing anything, because start is larger than end.

I'm putting forward the proposition that when end is lower than start, range should count downwards rather than upwards.

----------
components: None
messages: 148315
nosy: Asa.Dawson
priority: normal
severity: normal
status: open
title: range exits loop without action when start is higher than end
type: behavior
versions: Python 2.7, Python 3.2

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue13480>
_______________________________________


More information about the New-bugs-announce mailing list