Advanced Exception Handling in Python

preview_player
Показать описание
In this video, we learn how to professionally handle exceptions in Python. This goes beyond just basic try and except blocks.

◾◾◾◾◾◾◾◾◾◾◾◾◾◾◾◾◾
📚 Programming Books & Merch 📚

🌐 Social Media & Contact 🌐

Timestamps:
(0:00) Intro
(0:15) Basic Exception Handling
(2:06) Pass Statement
(3:15) Explicit Exception Handling
(5:13) Multiple Exception Handling
(5:40) General Exception Logging
(7:00) Multiple Exceptions in Same Block
(9:07) Re-Raise Exceptions
(10:25) Finally Statement
(11:00) Else Statement
(11:33) Outro
Рекомендации по теме
Комментарии
Автор

If you re-raise an exception, you should generally do it so: "raise from e". Internally, it sets a few flags and references the original exception.

leftblank
Автор

This should not be labeled as advanced exception handling because it is missing topics like exxeption chaining, traceback, exception hook, signal handling etc

dagpag
Автор

This is a great video for understanding the try/except usage in Python. Creating a good knowledge of the fundamentals is essential. Nice work! Thank you.

NiceChange
Автор

Also if you create a class in Python, in its methods you should (catch and) raise some exceptions (if something goes wrong) and catch them in the main function of your program.

the_huge_knight
Автор

Great video. I’m interested in more advanced topics like implementing traceback, if/when to subclass Exception, and custom errors.

harrycrab
Автор

I am truly amazed how much knowledge you have and how well you transmit it.
Every video is truly appreciated, thanks a lot for saving me and thank you in advance for all people that you are going to help in the future 📈

no_______one
Автор

Thank you so much. You are honestly a very useful and coherent source for beginners, professionals, and all in-between 👍🏾.

Raiden_Amani
Автор

thanks for this, was struggling with this but i "finally" do understand it.

asapnino
Автор

Coming from java background we don't have else. We just assumed that the line after the code that throws that exception would run and we would consider that the else. I just use that logic here when programming python. Seems using else would be a step backwards as it puts the code that follows in a different code block much lower on the screen.

numberformat
Автор

Keep doing what you are doing. You aren’t popular. But people care and watch. You are doing good

Alexander-msct
Автор

Nice demo.
Don't really need "as e" unless you want to use e. It suffices to use except <Exception>:

SiggeQwerty
Автор

First of all, thanks for this video :)

Now my comment :D
I think its a good practice to avoid these try catching if possible. For example if you already know a division by zero could happen, you can check it and if it would be the case you can throw an exception by yourself.

Schrom
Автор

Thank you very much. I was really looking for this and you just uploaded it

rhambosnax
Автор

this guy is great, thank you for the video

Mike-vjdo
Автор

Trying out Python, I learned you can execute functions right from the console. Is there a way to catch exceptions from functions written and executed directly in the console (not the source code) ?

redspade
Автор

What continue does in exception handling? Pass means ignore but what continue does?

kashifrana
Автор

Glad to watch concise and at the same time such an informative video.💥

beliakovdev
Автор

i watched this from many channels none of them included what finally does

rfatefehelvacoglu
Автор

thank you for all this and i want you make a video about qiskit

kamelboudaoud-qhod
Автор

When did Michael Mando start coding ? 🤣
Now really, thank you for great lesson.

seanshimon