Posts: 4,646
Threads: 1,493
Joined: Sep 2016
Jun-02-2019, 04:37 AM
(This post was last modified: Jun-02-2019, 04:38 AM by Skaperen.)
documentation says that the code in a
finally: clause gets run whether the exception happens, or not. what is the difference between using
finally: and just putting your code after the whole
try: ... except: as long as you don't use
continue or
return and flow of control always comes to the next statement?
Tradition is peer pressure from dead people
What do you call someone who speaks three languages? Trilingual. Two languages? Bilingual. One language? American.
Posts: 4,646
Threads: 1,493
Joined: Sep 2016
so if the exception might happen, finally: assures that you can close/teardown while not actually handling the exception, or doing continue/return/break in
except:. unless using continue/return/break i see following code as equivalent. but have been assuming their would always be an
except:. now i understand there might not be, and there are 4 ways to change flow, the 3 statements continue, return, break, and the lack of
except: (exception causing the flow change). yet another reason to be happy there is no
goto.
Tradition is peer pressure from dead people
What do you call someone who speaks three languages? Trilingual. Two languages? Bilingual. One language? American.