David Smith <[EMAIL PROTECTED]> wrote in
news:[EMAIL PROTECTED]: 

> range statements, the example doesn't work.
> 
> Given that the beginning and ending values for the inner range
> statement are the same, the inner range statement will never be

Is your question about the semantics of for else blocks or about the 
suitability of the algorithm given in the example? The for else block 
is behaving exactly as expected...

>>> range(1,1)
[]
>>> range(500,500)
[]
>>> 

see 
http://groups-
beta.google.com/group/comp.lang.python/browse_frm/thread/d6c084e791a00
2f4?q=for+else&hl=en&

for a good explanation of when the else part of the loop is executed. 
Basically, whenever the loop is exited normally, which is what happens 
when you iterate over an empty list like the one returned by 
range(1,1)


max


-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to