Using except: is a HUGE mistake

Published: 02 June 2021
on channel: mCoding
54,501
2.9k

Watch out for Exceptions vs BaseExceptions.

We look at the difference between Python's Exception objects and BaseException objects, and we consider the use cases and reasons for Python's choice to make a distinction between them. Understanding helps us understand why we shouldn't use a bare except "except: ...".

― mCoding with James Murphy (https://mcoding.io)

Source code: https://github.com/mCodingLLC/VideosS...
Python Exception Docs: https://docs.python.org/3/library/exc...
StackOverflow on GeneratorExit: https://stackoverflow.com/questions/3...

SUPPORT ME ⭐
---------------------------------------------------
Patreon:   / mcoding  
Paypal: https://www.paypal.com/donate/?hosted...
Other donations: https://mcoding.io/donate

BE ACTIVE IN MY COMMUNITY 😄
---------------------------------------------------
Discord:   / discord  
Github: https://github.com/mCodingLLC/
Reddit:   / mcoding  
Facebook:   / james.mcoding  

CHAPTERS
---------------------------------------------------
0:00 Intro
0:14 BaseException vs Exception
1:53 Use specific exceptions
3:51 Problems with bare except
5:08 GeneratorExit
6:20 Outro