I'm glad I asked :)

Thanks all who posted for your replies, the else-statement is a nice option.

Python again comes through to deal with those pesky feelings that something could be better :)

Ross.



Chris Rebert wrote:

Yes. try-except-*else*.

try:
    do_something_1()
    do_something_2()
except:
    print "Houston, we have a problem"
else: #runs only if no exception was thrown
    do_something_3()
    do_something_4()
    et_cetera()

Cheers,
Chris

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

Reply via email to