Duration 6:35

Using except: is a HUGE mistake

47 845 watched
0
2.6 K
Published 2 Jun 2021

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/VideosSampleCode Python Exception Docs: https://docs.python.org/3/library/exceptions.html StackOverflow on GeneratorExit: https://stackoverflow.com/questions/30862196/generatorexit-in-python-generator SUPPORT ME ⭐ --------------------------------------------------- Patreon: https://patreon.com/mCoding Paypal: https://www.paypal.com/donate/?hosted_button_id=VJY5SLZ8BJHEE Other donations: https://mcoding.io/donate BE ACTIVE IN MY COMMUNITY 😄 --------------------------------------------------- Discord: https://discord.gg/Ye9yJtZQuN Github: https://github.com/mCodingLLC/ Reddit: https://www.reddit.com/r/mCoding/ Facebook: https://www.facebook.com/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

Category

Show more

Comments - 126