Preventing and Handling Errors in Python

Satyam Gupta (~satyam1)


5

Votes

Description:

One will always get errors in their code, no matter the experience in programming. A lot of times, every programmer is focused on learning new things coming up in the language, but rarely one learns how to deal with errors. Dealing with errors is one of the most common problems in any programming language. In Python, you can either prevent errors before they happen or handle those errors after they happen. In programming, there are two opposite approaches to facing errors -Look before you Leap(LBYL) and Easier to Ask Forgiveness than Permission(EAFP). In my talk, I will quickly dive into both these strategies.

In the Look Before You Leap(LBYL) Style, one first check whether their conditions will succeed and proceeds further. Different code examples will be walked through to showcase this style. Similarly, the EAFP coding style is characterized by using try … except statements to catch and handle errors and exceptional situations that may occur during the execution of your code. This coding approach is quite popular in Python Community. It is mainly because of the fast and efficient error handling in Python.

This talk will delve much deeper than my already published article on the same topic: https://medium.com/codex/preventing-handling-errors-in-python-c1ae1f2fa689

Brief Outline: 1. Introduction to errors in Python 2. Look Before You Leap Style(LBYL) 3. Code examples of LBYL style 4. Easier to Ask for Forgiveness Than Permission(EAFP) 5. Code Examples of EAFP 6. Comparison of the two styles and when to implement which

Prerequisites:

Just basic Python should be known.

Content URLs:

Deck Link: https://docs.google.com/presentation/d/1ampfETbSnFOWIPNdUGIlsSffYZ55Lunt7LR2X86hUAs/edit?usp=sharing

Medium Blog: https://medium.com/@satyamg

Speaker Info:

Satyam works at MongoDB as a Software Engineer II, demonstrating his passion for Problem-Solving. He is a part of the Community team. His areas of interest revolve around Software Development, Backend Development, and Machine Learning. Recently promoted to Community Manager in June'23/ He loves to write technical blogs on Linkedin and Medium and attend and speak at various conferences. In his experience at various talks and conferences, he has felt that a lot of developers are still not aware of the ways one can handle errors while coding in Python and so this session would greatly help the Python community.

Speaker Links:

Medium Blog: https://medium.com/@satyamg Linkedin: https://www.linkedin.com/in/satyam20/

Talk 1: https://www.mongodb.com/community/forums/t/punjab-mug-mongodb-workshop-startup-journey-hackathon-and-fun/184370 Talk 2: https://www.mongodb.com/community/forums/t/punjab-mug-introduction-to-nosql-databases-and-mongodb-may-14-2022/162116 YouTube Talk: https://www.youtube.com/watch?v=6fUUpnon8BY&t=571s

Section: Others
Type: Talks
Target Audience: Beginner
Last Updated: