RajNewbie <[email protected]> writes:
> I do understand that we can use the code like -
> i = 0
> while True:
> i++
> if i > 200: raise infinite_Loop_Exception
> ...
> if <condition>: break
>
> But I am not very happy with this code for 3 reasons
I prefer:
from itertools import count
for i in count():
if i > 200: raise infinite_Loop_Exception
...
You could also use:
for i in xrange(200):
...
else:
raise infinite_Loop_Exception
The "else" clause runs only if no break statement is executed.
--
http://mail.python.org/mailman/listinfo/python-list