Python noob; please explain why this loop doesn\'t exit.
for i in range(0,10): print \"Hello, World!\" if i == 5: i = 15 print i next
Why would it exit? You're iterating over elements of range(0, 10), the only exit condition is that your run out of elements. Rebinding the name doesn't change anything inside the iterable. If you want to break prematurely, use break.
range(0, 10)
break
for i in range(0, 10): if i == 5: break