+ 1

why would you ever want to raise an exception?

8th Jul 2016, 1:10 AM
Kimberly Jo Robins
Kimberly Jo Robins - avatar
3 Respostas
+ 6
It's usefulness is realised when creating exceptions of your own. If you make a function or a class, you may want to raise a custom exception if something goes wrong so it will notify the user what happened, where it went wrong etc. It is especially useful when you are going to distribute the code so that when other developers use, they know what went wrong and how to handle it.
8th Jul 2016, 8:37 AM
Gershon Fosu
Gershon Fosu - avatar
+ 1
every case has an exception that you don't want to get disturbed by,that's why it is created as class function in python. with the help of this function you can even create your own exceptions ...it is a way to understand what kind of mistake you have made that caused problem..
8th Jul 2016, 4:14 PM
Shantam Vijayputra
Shantam Vijayputra - avatar
+ 1
To give you an idea about what is wrong with your code!
9th Jul 2016, 5:53 PM
Vashisht
Vashisht - avatar