Why You Should Think Twice Before Using Returns in Python

Why You Should Think Twice Before Using Returns in Python

57.744 Lượt nghe
Why You Should Think Twice Before Using Returns in Python
💡 Learn how to design great software in 7 steps: https://arjan.codes/designguide. Struggling with Python's unpredictable errors and None checks? In this video, I share a unique approach to making your code cleaner and more reliable using the returns package—no complicated try-except nests required. 🔥 GitHub Repository: https://git.arjan.codes/2024/returns. 🎓 ArjanCodes Courses: https://www.arjancodes.com/courses. 🔖 Chapters: 0:00 Intro 0:32 Why do we need a package like this? 3:02 Introduction to the Returns Package 3:18 What Are Containers? 3:55 The Maybe Container: Handling Missing Data Elegantly 6:40 Using Structural Pattern Matching with Maybe 8:01 Railway-Oriented Programming in Python 11:01 Mapping Exceptions to Railway-Oriented Programming 12:36 Using the @safe Decorator for Automatic Error Handling 14:12 The IO Container: Managing Side Effects 17:53 Should You Use the returns Package? 20:57 Final thoughts #arjancodes #softwaredesign #python