Hi. Exceptions make your program crash and should be avoided. If there is still a possibility for exceptions you should handle them in the except block. But it is not intended to get out of a while True loop. You can use a `break`statement to get out of a loop instead.
Python Engineer thanks , i have seen code that use custom exemptions to get out of while loops and take care of the exception on an except block. I see that happening when calling an inherited class function.
Ok I see the point. It is definitely good to check for edge cases and raise exceptions that are then handled in an except block. But what if there is no exception? Then your while True loop will run forever...So there should be additional mechanisms to get you out of the loop, and the main goal of the raised exception should not be to get you out of the loop but to check for errors.
Change the name for this video series. This is beginner stuff. Don't lie to people by calling it advanced. You lose your credibility from the start when you LIE to people right from the start.
Thanks for the crisp, clear and to the point tutorial. 🙏🏻
Dude you are an EXCELLENT TEACHER!!! Congrats
clear explanation. Great.
Thanks for this awesome tutorial, right on point!
Thank you. Cant thank enough.
You're welcome!
excellent!!!
I don't get why we need to create class. Can't we use just function 'test_value' ??
is exception a good use to get out of a while true loop?
Hi. Exceptions make your program crash and should be avoided. If there is still a possibility for exceptions you should handle them in the except block. But it is not intended to get out of a while True loop. You can use a `break`statement to get out of a loop instead.
Python Engineer thanks , i have seen code that use custom exemptions to get out of while loops and take care of the exception on an except block. I see that happening when calling an inherited class function.
Ok I see the point. It is definitely good to check for edge cases and raise exceptions that are then handled in an except block. But what if there is no exception? Then your while True loop will run forever...So there should be additional mechanisms to get you out of the loop, and the main goal of the raised exception should not be to get you out of the loop but to check for errors.
@@patloeber thank you! good videos! very informative and useful.
I love you so much
Is raising an exception the same as raising a valueerror
almost. A ValueError is a more specific Exception
@@patloeber thank you
great
Maybe you would like to make a video about Classes?))
Thanks for the suggestion! I will add it to my list
This is not advanced
Change the name for this video series. This is beginner stuff. Don't
lie to people by calling it advanced. You lose your credibility from
the start when you LIE to people right from the start.
To know how to something works is the basic, how to implement it in the right way is advanced, at least that's my opinion.