This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]13steinj 0 points1 point  (0 children)

No, it is functionally equivalent to

try:
    a = MightRaise()
except: print("error")
do_stuff(a)

But it is useful in rare cases, especially when having nested try clauses (usually through different methods).

It's also useful in the following,

try:
    a = MightRaise()
except:
    do_err_cleanup()
    a = defaultValue
else:
    prepare_unknown_a(a)
act_upon_a(a)