Yes, it does not matter. Your possible source of exception is the foo () function, and you still call it in both programs. Assigning its output to aaa will not change anything, since an exception will occur when foo () is called not at the time of the assignment (which is still in the try block).
source share