BJörn Lindqvist wrote:
> The code that you write in the positions A and B really are misplaced.
> They arent part of the iteration of list. The two tasks, find item and
> do something with item should be separated.
I think it is useful to have them joined. Consider a contrived example:
for i in (1,2,3,0,5,6):
try:
print 10 / i
except:
print 'Error in data'
break
else:
print 'Data processed cleanly'
Yes, you could use a flag variable instead:
done = 1
for i in (1,2,3,0,5,6):
try:
print 10 / i
except:
print 'Error in data'
done = 0
break
if done:
print 'Data processed cleanly'
...but that is not as clean imo.
Regards,
Jordan
--
http://mail.python.org/mailman/listinfo/python-list