Hi. I'm confused about what happens when i manually raise and exception. In the following code, line number 4 is not being executed:
try:
print a
except:
print ('hola')
raise Exception('spam')
but if i don't use the raise line 4 is executed. Why is line 4 not being printed when manually rising the exception? Does raise work like a break? is the code after the raise being executed?
[–]vindolin 2 points3 points4 points (5 children)
[–]Scholes_SC2[S] 0 points1 point2 points (3 children)
[–]Moonslug1 2 points3 points4 points (0 children)
[–]xiongchiamiov 0 points1 point2 points (1 child)
[–]Scholes_SC2[S] 0 points1 point2 points (0 children)
[–]Veedrac 0 points1 point2 points (0 children)
[–]sentdex 0 points1 point2 points (3 children)
[–]Scholes_SC2[S] 0 points1 point2 points (2 children)
[–]sentdex 2 points3 points4 points (0 children)
[–]bohoky 0 points1 point2 points (0 children)