Navigate Select ESC Close

Advanced Exception Handling in Python

2023-02-09 Science & Technology
80.3k
2.5k
63
NeuralNine
NeuralNine
476.0k subscribers

Unlock all features

FREE: Get instant access to 10 AI summaries, chats, or transcripts per day.

Description

In this video, we learn how to professionally handle exceptions in Python. This goes beyond just basic try and except blocks. ◾◾◾◾◾◾◾◾◾◾◾◾◾◾◾◾◾ 📚 Programming Books & Merch 📚 🐍 The Python Bible Book: https://www.neuralnine.com/books/ 💻 The Algorithm Bible Book: https://www.neuralnine.com/books/ 👕 Programming Merch: https://www.neuralnine.com/shop 🌐 Social Media & Contact 🌐 📱 Website: https://www.neuralnine.com/ 📷 Instagram: https://www.instagram.com/neuralnine 🐦 Twitter: https://twitter.com/neuralnine 🤵 LinkedIn: https://www.linkedin.com/company/neuralnine/ 📁 GitHub: https://github.com/NeuralNine 🎙 Discord: https://discord.gg/JU4xr8U3dm 🎵 Outro Music From: https://www.bensound.com/ 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

Top Comments (10)

@leftblank5315 2023-02-10

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.

19 1 replies
@NiceChange 2023-05-27

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.

8
@harrycrab8725 2023-06-10

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

4
@rhambosnax864 2023-02-11

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

0
@Mike-vj8do 2023-06-28

this guy is great, thank you for the video

0
@Earth.real47 2024-10-06

epic man! you explained really well.

0
@Alexander-ms2ct 2023-02-10

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

0
@efox29 2023-02-10

Every video is a banger.

0
@Raiden_Amani 2023-08-22

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

0
@Chord_Snack 2024-04-09

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

0

Unlock the Data Inside
Turn Videos into Knowledge

  • Get FREE 10/day: transcripts, summaries, chats
  • Chat with videos, export text & PDF
  • $1 free API credit for RAG, chatbots & research

Free forever plan • All features unlocked

App screenshot