`except: pass` Is a Python Anti-Pattern
Key Takeaways
The video discusses the anti-pattern of using `except: pass` in Python, emphasizing the importance of proper error handling and logging in production code.
Full Transcript
touch on one of my peeves, which is except pass. >> Okay. >> I think that should be a compile error. >> Oh, really? >> At bare minimum, you need a comment that says what you're doing there because essentially you're saying, "I would like to ignore an error." And you really should be explaining to somebody why. In production code, it's usually logging something. Even in just partial scripts for yourself, you better put something cuz you come back to it and you're really like, "Oh, well, we'll just ignore it. It's fine." >> [laughter] >> It's almost never fine. There was a reason it accepted in the first place. So, >> Yeah.
Original Description
Download your free Python Cheat Sheet here: https://realpython.com/cheatsheet
Free Python Skill Test with instant level + learning plan: https://realpython.com/skill-test
Want to learn faster? Become a Python Expert with unlimited access to 5,000+ tutorials, videos, and exercises: https://realpython.com/start
Listen to the full episode at https://realpython.com/podcasts/rpp/298 or wherever you get podcasts -- with Chris Trudeau (hosted by Chris Bailey).
🐍 Become a Python expert with real-world tutorials, on-demand courses, interactive quizzes, and 24/7 access to a community of experts at https://realpython.com
▰▰▰▰▰▰▰▰▰▰▰▰▰▰▰▰▰▰▰▰
🐍 Start Here → https://realpython.com/start
🗺️ Guided Learning Paths → https://realpython.com/learning-paths
🎧 Real Python Podcast → https://realpython.com/podcast
📚 Python Books → https://realpython.com/books
📖 Python Reference → https://realpython.com/ref
🧑💻 Quizzes & Exercises → https://realpython.com/quizzes
🎓 Live Courses: https://realpython.com/live
⭐️ Reviews & Learner Stories: https://realpython.com/learner-stories
▰▰▰▰▰▰▰▰▰▰▰▰▰▰▰▰▰▰▰▰
Related Reads
📰
📰
📰
📰
Authorization in Rails: Why a Record ID Is Never Enough
Medium · Programming
Backend Development for Startups: What to Build Before You Scale
Medium · Startup
How your terminal works, one keypress at a time (IWSET #3)
Medium · Programming
20 Advanced Java Interview Questions You Should Revise Before Your Next Interview
Medium · Programming
🎓
Tutor Explanation
DeepCamp AI