+ 2

why no ' : ' in the end of raise exception statement?

23rd Sep 2016, 10:45 AM
ankur pancholi
ankur pancholi - avatar
4 Antworten
+ 1
Because you are confusing it with except. Raise just throws an exception, no need for a block afterwards.
23rd Sep 2016, 11:10 AM
Zen
Zen - avatar
+ 1
Conceptually, colons introduce a "group of statements" (offset by indentation) to execute related to the line with the colon. Raising an exception immediately *jumps away* from wherever you are, so a block makes no sense here.
23rd Sep 2016, 3:25 PM
Kirk Schafer
Kirk Schafer - avatar
+ 1
' : ' is used where you want a block of statements for that particular line Or you can say that it is for indentation
3rd Feb 2017, 3:46 AM
Himanshu
0
raise is method to raising exception using type of exception and error you want to show when validation of data types.
7th Jan 2017, 7:36 AM
Ravi Verma
Ravi Verma - avatar