I am currently writing a small python script. Is it ok to use break during an ExceptionError like the following ? I have 2 lists (a and b), and I'm trying to transfer one value from a to b every loop.
Here is the code:
while True:
try:
b.append(a.pop(0))
except IndexError:
print "a is empty !"
break
[...other code I don't wanna execute if I have an IndexError...]
Is it python-speaking "ok" to do like this ? I mean is it the best way in python to exit the loop inside of an ErrorException ?
Thanks for taking some time for it !